in reply to Socket deadlock doubt in code
server.pl
while ( defined ($response = <CLIENT>)){ ...client.pl
while ($line = <SOCKET>) { print SOCKET "Client says hellooooo toooo !!!"; SOCKET->autoflush(); ...
One problem is that you're trying to read lines on the server side with <...> (aka readline), but on the client side you're not writing any newlines... The effect of this is that the server hangs in $response = <CLIENT> waiting for a newline.
Note that flushing and a communication protocol involving newlines are two different things. In other words, flushing some output does not add a newline.
P.S.: SOCKET->autoflush sets an operation mode of the handle - as opposed to SOCKET->flush - so the former needs to be called only once.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Socket deadlock doubt in code
by sajanagr (Acolyte) on Jun 23, 2010 at 05:18 UTC | |
by sajanagr (Acolyte) on Jun 23, 2010 at 09:18 UTC | |
by rowdog (Curate) on Jun 23, 2010 at 23:30 UTC | |
by sajanagr (Acolyte) on Jun 24, 2010 at 05:27 UTC | |
by rowdog (Curate) on Jun 24, 2010 at 17:41 UTC |