... my $remoteIP ='a.b.c.d'; my $port = 22; #aiming for sshd - use your own port here my $iaddr = inet_aton($remoteIP) || die("No $remoteIP around"); my $paddr = sockaddr_in($port, $iaddr); my $protocol = getprotobyname('tcp'); socket(SOCK, PF_INET, SOCK_STREAM, $protocol) || die("socket() fai +led: $!"); connect(SOCK, $paddr) || die("connect() failed: $!"); $line = <SOCK>; #read a line print("$line online\n"); #print it close(SOCK); #close socket ...
In reply to Re: Socket Question
by RaduH
in thread Socket Question
by perlsyntax
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |