Wanting2LearnMan
asked on
Replacing CCeSocket with CSocket or CAsyncSocket
I have replaced CCeSocket with CSocket in my Windows Mobile application and It seems to work well.
However I wish to use non-blocking sockets so tried using CAsyncSocket but I cannot conect to my server.
Why could this be?
However I wish to use non-blocking sockets so tried using CAsyncSocket but I cannot conect to my server.
Why could this be?
What error code do you get using 'GetLastError()'?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
The error I get is WSAEWOULDBLOCK.
ASKER
>>That means differentlly to using CSocket you have to
>>- call the CAsyncSocket::Create function to get a socket handle
>>- call the CAsyncSocket::Connect (after Create was successful)
>>Did you already made these 2 calls?
Yes my code is as follows
CAsyncSocket *sock;
sock = new CAsyncSocket;
sock->Create();
if (sock->Connect(sIpAddress, nPort) == FALSE)
{
DWORD dwErr = GetLastError(); ////The error I get is WSAEWOULDBLOCK
//blah blah
}
>>- call the CAsyncSocket::Create function to get a socket handle
>>- call the CAsyncSocket::Connect (after Create was successful)
>>Did you already made these 2 calls?
Yes my code is as follows
CAsyncSocket *sock;
sock = new CAsyncSocket;
sock->Create();
if (sock->Connect(sIpAddress,
{
DWORD dwErr = GetLastError(); ////The error I get is WSAEWOULDBLOCK
//blah blah
}
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.