none
10035 Socket Error on Connect

    Question

  • I am getting Error 10035 after issuing Connect.

    The Create method on the connect socket is successful.

    Create and Listen on the Listening Socket are successful , the computerid and port parameters are correct and are set  to "loopback" and 4000, which work OK on a similar program which is a Dialog application rather than an MDI application.

    The OnAccept event is not issued on the Listening Socket and so the connection is not completed.

    Does error10035 indicate a fault at the connect end and how can this be avoided.?

    If not, what is wrong at the Listen end?

    Are there any further levels of debug which I can use to understand this problem?

     

     

     

      void CStrategy2View:SurprisenClient()
    {

     bool bool1,bool2,bool3;
     int interr1,interr2,interr3;
     // TODO: Add your command handler code here
     interr1 = 0;
     ConfigDlg.DoModal();
     bool1=ConnectSocket.Create();
     interr1 = ConnectSocket.GetLastError();
     interr2 = 0;
     bool2 = ConnectSocket.Connect(ConfigDlg.m_computerid,ConfigDlg.port);
     interr2 = ConnectSocket.GetLastError();
     Client = TRUE;
     
    }

    void CStrategy2View:SurprisenServer()
    {

     // TODO: Add your command handler code here
     bool bool1,bool2;
     int interr1,interr2;
     bool1 = ListenSocket.Create(ConfigDlg.port);
     interr1 = GetLastError();
     bool2 = ListenSocket.Listen();
     interr2 = GetLastError();
     Client = FALSE;

     
    }

    Tuesday, July 24, 2007 5:30 PM

All replies

  • Error 10035 is described as:

    WSAEWOULDBLOCK
    10035
    A non-blocking socket operation could not be completed immediately.

     

    What this means is the operation would normally be a blocked operation (i.e would only return when completed) but is operating in a non blocking mode, thus it did not have time to complete.

     

    Check out

    The Connect method will block, unless you specifically set the Blocking property to false prior to calling Connect. If you are using a connection-oriented protocol like TCP and you do disable blocking, Connect will throw a SocketException because it needs time to make the connection. Connectionless protocols will not throw an exception because they simply establish a default remote host. You can use SocketException.ErrorCode to obtain the specific error code. After you have obtained this code, refer to the Windows Sockets version 2 API error code documentation in the MSDN library for a detailed description of the error. If the error returned WSAEWOULDBLOCK, the remote host connection has been initiated by a connection-oriented Socket, but has not yet completed successfully. Use the Poll method to determine when the Socket is finished connecting.

     

    From

    http://msdn2.microsoft.com/en-us/library/ych8bz3x(vs.80).aspx

     

     

    Wednesday, July 25, 2007 4:41 AM
  • Hi Paul,

    Thanks for the information.

    I realised there are 2 things I forgot to tell you:-

    1. I am using Visual Studio 6.

    2. I am using CAsyncSocket Class rather than CSocket.

     

    The procedure I am using works in a Dialog application rather than the MDI application I am currently using, which completely fails to Connect. The listening Socket fails to issue the OnAccept event and the connecting Socket fails to issue the OnConnect event.

    I dont know how much difference this makes?

    Regards

    Boatprog

    Friday, July 27, 2007 10:25 AM