use IO::Socket; use Sys::Hostname; my($ipaddr)=inet_ntoa((gethostbyname(hostname))[4]); $remote = IO::Socket::INET->new( Proto => 'tcp', PeerAddr=> "$ipaddr:8087", Reuse => 1, ) or die "$!"; print "Connected to ", $remote->peerhost, " on port: ", $remote->peerport, "\n"; $remote->autoflush(1); # Send immediately while (<>) { print $remote " "; print $remote "sendplc "; print $remote $_; # Send to Server }#Want to keep the client running.