M.I.T = Multimedia IT dept.

socket connection with perl

,

#!/usr/bin/perl
use IO::Socket;
$remote_host="www.ap.ntdtv.com";
$remote_port="80";
#$socket = IO::Socket::INET->new("$remote_host:$remote_port");
#print "$socket\n";


#or die "Can't connect!!: $!\n"
;
$socket = IO::Socket::INET->new(
Proto => "tcp",
Timeout => 5, # in seconds
PeerAddr => $remote_host,
PeerPort => $remote_port,
Type => SOCK_STREAM,
)
#or die $@
;

if($socket) {$success=1};
if(!$socket) {$success=0};
if($success eq 1){print "socket connected!!\n"};
if($success eq 0){print "socket無法建立!!\n"};

# print $socket
#print $socket "data\n";
#$line=<$socket>;
#print $line;
# terminate the connection

close($socket);

easy proxy to use: 3proxy :)firewall rules of iptables for general purpose...

How to use Quote function:

  1. Select some text
  2. Click on the Quote link

Write a comment

Comment
(BBcode and HTML is turned off for anonymous user comments.)

If you can't read the words, press the small reload icon.


Smilies

February 2012
M T W T F S S
January 2012March 2012
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29