frankus has asked for the wisdom of the Perl Monks concerning the following question:
I've just rolled my own server ( in C because it ties into C APIs ). I'm writing a client in Perl to sit on another machine and interogate it.
The problem is, that I can telnet to the server and the server works, returning the grid reference for a location or postcode.
Using the Perl, client the data is sent and the server replies (I can see that from the server log) but the data data doesn't appear back on the client, untill I close the server down, presumably closing the pipe.
I know I've done something fundamentally stoopid, what is it?
Here is the code:
#!/usr/local/bin/perl use strict; use warnings; use IO::Socket; use Data::Dumper; $|=1; my $remote_host = '1XX.1XX.XX.XX'; my $remote_port = 1139; my $socket = IO::Socket::INET->new ( PeerAddr => $remote_host, PeerPort => $remote_port, Proto => "tcp", Type => SOCK_STREAM ) or die "Couldn't connect to $remote_host:$remote_port +: $@\n"; $socket->autoflush(1); while (<>){ print $socket $_; my @answer = <$socket>; print Dumper \@answer; } close( $socket );
--
Brother Frankus.
¤
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Socket gripes
by sch (Pilgrim) on Oct 25, 2002 at 14:35 UTC | |
by frankus (Priest) on Oct 25, 2002 at 14:46 UTC | |
by sch (Pilgrim) on Oct 25, 2002 at 14:49 UTC | |
by frankus (Priest) on Oct 25, 2002 at 14:56 UTC | |
Re: Socket gripes
by Thelonius (Priest) on Oct 25, 2002 at 15:38 UTC | |
by John M. Dlugosz (Monsignor) on Oct 25, 2002 at 18:44 UTC | |
by Thelonius (Priest) on Oct 28, 2002 at 14:47 UTC | |
by frankus (Priest) on Oct 25, 2002 at 15:50 UTC |
Back to
Seekers of Perl Wisdom