Re: unexpected behavior with GIOChannels?

If I connect that to something like netcat (nc -l $host -p $port),
then kill netcat, I'd expect a HUP since the socket is broken. Instead
i get an endless loop of:

$VAR1 = \[

Which seems odd since if there's no socket, how can there be data
waiting to be read?

Basicly my goal is to recognize when the other side has broken the
socket, so that perl can clean up its half. Am I even going about this
the right way?

IIRC, you actually have to read to clear the 'in' event. I suspect it is repeating the same event. I would try actually reading. Send a 10 byte file, read all you can into a buffer, then you should get the HUP

[I cannot test it right now as I do not have the current version up on any machines here.]


John McDermott
Writer, Educator, Consultant
jjm jkintl com
V +1 505/377-6293 F +1 505/377-6313

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]