WSAEWOULDBLOCK second time I connect to the server?
Hello!
I'm using CAsyncSocket to connect to a server (running on a linux system).
The first time I connect everything works perfectly, but the second time I
get an WSAEWOULDBLOCK error and everything halts
I'm guessing that when I ended the session I did something wrong and the
server is still processing my session
some code snippets:
-----
class meAsyncSocket : public CAsyncSocket
// init sockets and connect
AfxSocketInit(NULL);
if(!m_pSocket)
{
m_pSocket = new meAsyncSocket(this->GetSafeHwnd());
brc = m_pSocket->Create(/*m_hostport*/);
if(!brc)
{
return ShowError1(m_pSocket->GetLastError(),_T("Unable to create
socket"));
}
}
// connect
brc = m_pSocket->Connect(m_hostaddress,m_hostport);
if(!brc)
{
crc = m_pSocket->GetLastError();
if(crc==WSAEWOULDBLOCK)
{
m_cmdStatus = 1;
gLog.LOG(11,_T("LoadMask(0) Done"),eDebug);gLog.Write();
break;
}
else
{
return ShowError1(m_pSocket->GetLastError(),_T("Unable to Connect to
host"));
}
}
// end connection
m_pSocket->Close();
delete m_pSocket;
m_pSocket = NULL;
----
Hopefully someone can see what I have done wrong!
// Anders
--
English is not my first, or second, language
so anything strange, or insulting, is due to
the translation.
Please correct me so I may learn better English!