Answer the question
In order to leave comments, you need to log in
`
How to catch Errno::ECONNRESET error?
How can you catch a tiny application opening a socket and accepting connections with an error:
`eof?': Connection reset by peer (Errno::ECONNRESET)
The code is:
# Received a connect to the server (listening) socket. <br>
if sock == @server_socket<br>
#sock - TCPServer.accept socket<br>
accept_new_connection<br>
<br>
else<br>
<br>
# Received something on a client socket<br>
if sock.eof?<br>
<br>
sock.close<br>
@descriptors.delete(sock)<br>
<br>
end<br>
end
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question