![]() |
SCTP connection reuse
Hi,
I have a client-server application based on SCTP. When I kill the client application abnormally ( Cntrl c) and then try to reconnect to the server it gives "Transport endpoint is already connected" errno : EISCONN The code is too large to paste it here. I wanted to know whether SCTP connection still persists even though client application is terminated. Can I reuse the previous connection? |
Re: SCTP connection reuse
Your server is just in the wrong state. It needs some way of detecting a killed client application and closing that connection. Once you have done that you will be able to reuse the connection.
|
Re: SCTP connection reuse
Code:
bool SCTPLINKCLASS::SCTPLinkSetup ( string sourceIP, string destIP, int port_number)When I abruptly terminate the client (using Cntrl C) and restart the client IMMEDIATELY (Please note it only happens when I restart it immediately) "connect" call above fails. I have checked the error code using perror it gives Transport endpoint is already connected. However, if I use the same socket (whose connect call has failed) I am able to transfer data to the server. I have also checked for the connected socket using /proc/net/sctp/assocs It shows proper socket connection. I have verified the client port number at server end.It shows same as listed in /proc/net/sctp/assocs. As per my knowledge, the connect call internally calls bind call to bind to a local port number and local IP . What I am confused with is that even if server doesnot handle abrupt close of client (as suggested by xptios ) but the connection is unique for (local port , local IP , remote port , remote IP)..And when I connect client second time after abruptly closing it , the port number ( ephemeral port number by OS )that is allocated during bind ( that is called from within connect system call) is different from previous one. So how does it show that the client is already connected? |
| All times are GMT +5.5. The time now is 04:37. |