0
CSocket listSock,lisRecvSock;
if(!listSock.Create(pwd->m_ServerPort))//sometimes i got a CResourceException,why?
{
pwd->GetSocketError();
return -1;
}
if(!lisRecvSock.Create(pwd->m_ServerPortRecv))
{
pwd->GetSocketError();
return -1;
}
lisRecvSock.Listen(3);
listSock.Listen(3);
//and the Accept sometimes return WSAEINVAL,accordingto msdn,I should Bind the socket
//to a specific port and IP address,but the CSocket would Bind when Create invoked,isn't it?
if(!listSock.Accept(pwd->SendSock))
{
pwd->GetSocketError();
return -1;
}
爲什麼當Create()被調用並且WSAEINVAL被重新構造時我得到了CResourceException? 接受有時候會返回WSAEINVAL,根據msdn,我應該將套接字 綁定到特定的端口和IP地址,但CSocket會在創建時調用綁定,不是嗎?未能創建CSocket對象