Link to home
Start Free TrialLog in
Avatar of Wanting2LearnMan
Wanting2LearnManFlag for United Kingdom of Great Britain and Northern Ireland

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?
Avatar of jkr
jkr
Flag of Germany image

What error code do you get using 'GetLastError()'?
ASKER CERTIFIED SOLUTION
Avatar of itsmeandnobodyelse
itsmeandnobodyelse
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Wanting2LearnMan

ASKER

The error I get is WSAEWOULDBLOCK.  
>>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
}
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial