msalerno has asked for the wisdom of the Perl Monks concerning the following question:
Then I send a string ending in a ; FYI, in the server, $/ = ";"; I've tried just about everything I can think of... Can anyone out there spot the error? ThanksTrying to aquire lock on log Connection Established Lock aquired
#!/usr/bin/perl -w use strict; use IO::Socket::INET; my $text = 'Hello;'; my $host = "10.10.30.130"; my $port = "5678"; my $sock = IO::Socket::INET->new( PeerAddr => $host, PeerPort => $port, Proto => 'tcp' ); $sock or die "Can't connect to $host:$port\n"; #$sock->autoflush(1); my $input = ""; my $char = ""; until ($input =~ /Lock aquired\s*$/){ sysread($sock, $char, 1); $input .= $char; } print $input; #$sock->send($text ); #syswrite $sock,$text ; print $sock $text ; $sock->shutdown(1); close $sock; exit;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Read and write to socket
by BrowserUk (Patriarch) on Oct 16, 2007 at 21:35 UTC | |
by msalerno (Beadle) on Oct 17, 2007 at 01:00 UTC | |
|
Re: Read and write to socket
by zentara (Cardinal) on Oct 17, 2007 at 11:52 UTC | |
|
Re: Read and write to socket
by ulfwil (Initiate) on May 11, 2011 at 06:44 UTC |