Melly has asked for the wisdom of the Perl Monks concerning the following question:
Hi Monkees
I have a perl socket client, and a small problem. The socket server at the other end is not sending a newline, just a line of data terminated with '~'. At the moment my client just sits there (more accurately, it times out), since due to the lack of newline it never seems to read from the socket.
I assume there may be more questions, but here is the relevant bit of code - how should I resolve this problem?
$SIG{ALRM} = sub{die "timeout"}; eval{ alarm($timeout); $line_in = <$socket>; alarm(0); };
So... how do I read from $socket to $line_in when there is no newline?
Tom Melly, tom@tomandlu.co.uk
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Question from socket newbie
by blokhead (Monsignor) on Sep 26, 2003 at 16:13 UTC | |
by Melly (Chaplain) on Sep 26, 2003 at 16:22 UTC | |
|
Re: Question from socket newbie
by hardburn (Abbot) on Sep 26, 2003 at 16:12 UTC | |
by Melly (Chaplain) on Sep 26, 2003 at 16:17 UTC | |
|
Re: Question from socket newbie ($/ | eof)
by tye (Sage) on Sep 26, 2003 at 17:42 UTC |