Now the problem is, when a client disconnects, the service side is how to identify the queue in which the socket, and remove?
Void CServer: : OnAccept (int nErrorCode)
{
CSocket * pSocket=new CSocket ();
If (Accept pSocket) (*)
{
M_Clientlist. AddTail (pSocket);
}
The else
{
The delete pSocket;
}
CSocket: : OnAccept (nErrorCode);
}
Void CServer: : OnClose (int nErrorCode)
{
CSocket: : OnClose (nErrorCode);
}
CodePudding user response:
getpeername