$port = getservbyname($port, 'tcp') ; $iaddr = inet_aton($hostname) ; $paddr = sockaddr_in($port, $iaddr) ; $proto = getprotobyname('tcp'); socket(SOCK, PF_INET, SOCK_STREAM, $proto) or $not_response = 1 ; connect(SOCK, $paddr) or $not_response = 1 ; while (defined($line =)) { push @remote_data, $line; if ( $check == 0 ) { close (SOCK) ; }