Winsock2 WSAGetLastError 10061

  • Dear support,


    I have a problem with winsock2, i write a simple server and client application, the server sock runs without problems on the NETDCUA5.
    And the client socket runs on a windows 10 machine. The communication between server and client socktet runs only in debug session (conmanclient3, cmaccpet3).


    But start the server socket not in the debug mode, can`t connect the client. The WSAGetLastError return allways 10061, connection refused.


    What is wrong ?


    thank you


    Daniel

  • Hm very strange,
    you are really sure that you use the same port for "bind" the "listen" on server side as the client tries to connect to?
    Server is really waiting in "accept" for the connection from client?
    Any code details?

    F&S Elektronik Systeme GmbH
    As this is an international forum, please try to post in English.
    Da dies ein internationales Forum ist, bitten wir darum, Beiträge möglichst in Englisch zu verfassen.

    Edited once, last by fs-support_ZU ().

  • Hi,


    yes, its very strange :(
    im really sure, both sockets runs on the same port (4444), and the server socket is waiting in "accept" for a client connection.
    here is a code snippet from server:



    and here is the client connection function from .NET 4.5



    the firewall is disabled on client side. Its really really strange ..... starts the server socket from the IDE with "conmanlient3 and cmaccept3" runs the communication between server and client socket with no problems.


    greetings


    Daniels

  • Hm, no idea.
    But Telnet Server works so i assume the problem it is related to the port 4444, did you try a free port < 1024? E.g. 700.

    F&S Elektronik Systeme GmbH
    As this is an international forum, please try to post in English.
    Da dies ein internationales Forum ist, bitten wir darum, Beiträge möglichst in Englisch zu verfassen.

  • Hi,


    I have found the failure, the problem is the client :D


    that works on client side, but its c++ not .NET :D


    Code
    1. // Setup our socket address structure
    2. SOCKADDR_IN SockAddr;
    3. SockAddr.sin_port = htons(4444);
    4. SockAddr.sin_family = AF_INET;
    5. SockAddr.sin_addr.s_addr = inet_addr("192.168.0.3");


    ok, thank you for your help


    greetings


    Daniel