Need help with detecting socket disconnection
Hi, I'm developing a server using c++ blocking, multithreaded and multi-client socket(Winsock) programming. My problem is when the client got a connection disruption, the server won't automatically detects it and keep receiving data from the client. I'm curious why can't it auto detect since this is a blocking connection. Is it because of the multithreading? Anyway, I tried to detect the disconnected client by adding the client socket into a list array and then detect with a recv using a timer. I managed to detect the disconnected client by this way but when i try to close the socket, the program will crash. I think the reason for this is the socket is still receiving data in another thread. I don't want to close my listener socket just because of 1 disconnected client. Please help me.....
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement