AnsweredAssumed Answered

accept() returns error but does not signal remote client to close

Question asked by Tim Duncan on Nov 11, 2013
Latest reply on Nov 12, 2013 by Tim Duncan

I'm writing a simple TCP server in MQX using CW 10.5 to run on a TWR-K60F120M.  I create a listening socket, bind it, and call RTCS_selectset().  When that returns, if the selected socket is the listening socket, I try to accept it.  If it's any other socket (which is already connected), I receive data.  After a few successful connections, with data being sent and received successfuly, the sixth socket accepted will fail with accept() returning RTCS_SOCKET_ERROR.  RTCS_geterror(selected_sock) {where selected_sock is the listening socket} returns RTCSERR_OUT_OF_SOCKETS, indicating there is no memory available to accept the new socket.  This is fine, and understandable.  What I don't get, however, is that RTCS never closes the connection with the remote client!  Watching in Wireshark, I see the SYN, SYN/ACK, ACK handshake, followed soon after by the client sending data, because the client thinks the connection is open.  Shouldn't accept() send a FIN or RST flag to the client to terminate or abort the connection upon failure?