-
September 1st, 2003, 11:00 AM
#1
CAsyncSocket::Connect() error
Hello everybody,
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.
mySocket.Create();
BOOL b = mySocket.Connect(''"ftp.microsoft.com", 21); //CLIENT see doc
if(b == FALSE)
int err = CAsyncSocket::GetLastError();
Can you give me some idea?
Tanks,
Gelu
-
September 1st, 2003, 11:37 AM
#2
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("207.46.133.140", 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,
- Nigel
-
September 2nd, 2003, 01:48 AM
#3
Hello Nigel,
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.
Thanks,
Gelu
-
September 2nd, 2003, 01:55 AM
#4
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
#5
this info seems to be very helpfull for me. I will try it soon .
Thanks
-
September 2nd, 2003, 02:24 AM
#6
Actually, on Windows 2000, it returns always FALSE with error = 10022
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|