CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Feb 2001

    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.

    BOOL b = mySocket.Connect(''"ftp.microsoft.com", 21); //CLIENT see doc
    if(b == FALSE)
    int err = CAsyncSocket::GetLastError();

    Can you give me some idea?


  2. #2
    Join Date
    Sep 2001
    San Diego
    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("", 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

  3. #3
    Join Date
    Feb 2001
    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.


  4. #4
    Join Date
    Nov 2002
    Los Angeles, California
    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."

  5. #5
    Join Date
    Feb 2001
    this info seems to be very helpfull for me. I will try it soon .

  6. #6
    Join Date
    Feb 2001
    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

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.