Menu

#38 socket_connect() result not checked

closed
nobody
None
5
2010-09-14
2010-06-23
No

If an initiator tries to connect to a port that isn't accepting connections there is no "connection refused" error.

The first time you get an error is after processReadSet runs, which calls SocketConnection::readFromSocket, which calls recv, which returns zero, causing an SocketRecvFailure exception which prints the message "Connection reset by peer"
That message is very misleading, because it corresponds to the description of a real socket error, ECONNRESET, which is completely unrelated to the "connection refused" case.

Is there a good reason why the return value of socket_connect() is not checked in SocketConnector::connect() ?
Checking that return value would allow the error to be reported sooner, and the actual error condition (which will usually be ECONNREFUSED) could be reported.

Discussion

  • Jonathan Wakely

    Jonathan Wakely - 2010-06-24

    ah yes, it's a dup, sorry

     
  • Oren Miller

    Oren Miller - 2010-09-14

    Fixed

     
  • Oren Miller

    Oren Miller - 2010-09-14
    • status: open --> closed
     

Log in to post a comment.