Following the guidelines I found in numerous examples on the web, I wrote a simple Client-Server app in Perl. However, it appears that the send buffer does not get flushed until the connection is closed. That's fine for one-way data transfer, but I need the server to be able to receive some request parameters and then respond to them.
Code fragment illustrating how I'm sending lines of data: --- use Socket; $| = 1; # force a fflush after every print my $servername = 'localhost'; my $port = 8888; my $proto = getprotobyname('tcp'); my $iaddr = inet_aton($servername); my $paddr = sockaddr_in($port, $iaddr); socket(SOCKET, PF_INET, SOCK_STREAM, $proto) or die "socket: $!"; connect(SOCKET, $paddr) or die "connect: $!"; my $line; # # Start off by sending the server a message, terminated by new-line # print SOCKET "MAXLENGTH=14 MAXWORDS=200\n"; # # Now read the server's reply # while ($line = <SOCKET>) { print "$line"; } close SOCKET or die "close: $!"; --- (Omitting server code for brevity -- hopefully, my error is evident here) This deadlocks waiting on $line = <SOCKET>. Using the debugger on the server, I can see that the connection is accepted, but the client's initial message is never received. Any suggestions? Thanks, Chap -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/