G
Geometric Patterns
Hi,
I have built a telnet "chat server" using TCPserver and a select
statement.
If a client exits "cleanly" (such as by closing the shell in which
telnet is running), I can recognize the socket as being terminated using
sock.eof? and everything's fine.
But if a client does wacky stuff like suspend their telnet process with
ctrl+z, then my server hangs at this line:
s = sock.gets()
(where s is a string and sock is the socket of the client)
I tried using s = sock.read and the server could not get past that line,
even for successfully connected clients. I tried using s =
sock.recvfrom(500)[0] but when the client hits that line I get the error
"in `recvfrom': recv for buffered IO (IOError)".
Any help you can provide would be gratefully received!
Very best,
- Andrew
I have built a telnet "chat server" using TCPserver and a select
statement.
If a client exits "cleanly" (such as by closing the shell in which
telnet is running), I can recognize the socket as being terminated using
sock.eof? and everything's fine.
But if a client does wacky stuff like suspend their telnet process with
ctrl+z, then my server hangs at this line:
s = sock.gets()
(where s is a string and sock is the socket of the client)
I tried using s = sock.read and the server could not get past that line,
even for successfully connected clients. I tried using s =
sock.recvfrom(500)[0] but when the client hits that line I get the error
"in `recvfrom': recv for buffered IO (IOError)".
Any help you can provide would be gratefully received!
Very best,
- Andrew