Graceful close of winsock?
Posted on 1998-07-05
I'm trying to write a server. There is a button for the user to press to stop the server. Then the server will close all the client sockets that are connecting to it. Here is the code:
CClientSock* pSocket =(CClientSock*)m_connectionList.RemoveHead();
while (pSocket->Receive(Buffer,50) > 0);
However, the server 'hanged' at the statement : while(pSocket->Receive(Buffer, 50)>0);
But at that time, my clients were not intending to send anything to the server.
p.s. I'm using MFC the CSocket class. CClientSock is the derived class of CSocket