September 1st, 2003, 11:00 AM
I 'm using a CAsyncSocket class in a VisualC++ program.
When I'm working on WIN98 everything works fine. But, on Windows 2000 a WSAEINVAL (10022) error occures.
BOOL b = mySocket.Connect(''"ftp.microsoft.com", 21); //CLIENT see doc
if(b == FALSE)
int err = CAsyncSocket::GetLastError();
Can you give me some idea?
September 1st, 2003, 11:37 AM
The error is telling you that there is an invalid parameter in the call.
The port number is difficult to mess up, but the host address could be badly formatted (as shown in your example).
If you want, you can also specify the ip address in the host string. This way the application doesn't need to resolve the address;
BOOL b = mySocket.Connect("22.214.171.124", 21);
I would check your original string though. It looks incorrect in the example you show (there's something unusual about the beginning of the string).
Hope this helps,
September 2nd, 2003, 01:48 AM
There is a cut & paste error in my example.
I analyzed better my code:
The mySocket.Connect() function always returns FALSE and the last error code vary between 10022 and 10035.
I tried it with verified IP addresses and ports.
But, sometime, the socket is connected properly and I can work with.
September 2nd, 2003, 01:55 AM
A return value of 10035 is not an error. It is to be expected.
It is WSAEWOULDBLOCK which means that the requested
operation would block and this is a non-blocking socket. The operation will be completed latter and your program will be
notified with the OnConnect callback.
Wakeup in the morning and kick the day in the teeth!! Or something like that.
"i don't want to write leak free code or most efficient code, like others traditional (so called expert) coders do."
September 2nd, 2003, 02:04 AM
this info seems to be very helpfull for me. I will try it soon .
September 2nd, 2003, 02:24 AM
Actually, on Windows 2000, it returns always FALSE with error = 10022
Click Here to Expand Forum to Full Width
This a Codeguru.com survey!