Winsock connect error system error 10061 system message

Stuck with Winsock Error 10061? We can help you.Winsock error 10061 occurs when the target machine we are trying to connect actively refuses the request.

Stuck with Winsock Error 10061? We can help you.

Winsock error 10061 occurs when the target machine we are trying to connect actively refuses the request.

This ‘Connection Refused’ error happens generally when the service with which we are trying to connect is inactive.

Here at Bobcares, we often get requests from our customers to fix similar errors as a part of our Server Management Services.

Today let’s see how our Support Engineers fix this error for our customers.

How to fix Winsock Error 10061?

Before going into the steps of fixing Winsock Error 10061, we will see some of the common causes for this error.

Common causes for this Error:

1. The most common cause is a misconfigured server, full server, or using an incorrect port to connect.

2. Poor or no internet connection.

3. Service inactive on the destination server.

4. Trying to connect to the wrong host.

5. Using a port number that is higher than 655355.

6. A firewall or anti-virus software on the local computer or network connection blocking the connection.

7. Corrupted registry.

Steps to fix Winsock Error 10061

1. First we must check if the Internet connection is working properly or not.

2. Next we need to ensure that firewall is not blocking the Winsock connection.

Generally, firewalls are designed to prevent unauthorized access soo there is a possibility that it can see Winsock as a potential threat.

To unblock Winsock, we can use the following steps:

a. First, locate the firewall in the navigation bar (next to the clock)
b. Then right-click and take the “Exception List”
c. In the exception list, if Winsock is not already displayed, we will add it.

3. Run a scan to check for potential threats or viruses using any anti-virus.

4. Clean out the registry using a registry cleaner to scan through the part of the PC and repair any of the damaged settings if any.

5. After that we can verify whether the host is resolving to the correct IP address

6. Then we will check whether the ports are open and listening.

7. We must keep in mind to use any port less than 65535.

8. After this we will ensure that the service can be connected to all IP addresses. Also, we will check if the ISP allows outbound traffic on port 25.

10. If all the above steps did not help to connect, we will disable the firewall or anti-virus software and try to connect again.

[Still, facing Winsock error? We are happy to help you!]

Conclusion

To conclude, we saw various causes for Winsock error 10061 along with the steps our Support Techs follow to fix this error for our customers.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

var google_conversion_label = «owonCMyG5nEQ0aD71QM»;

SQL Server 2008 Enterprise SQL Server 2008 R2 Enterprise Microsoft SQL Server 2005 Service Pack 3 Microsoft SQL Server 2005 Service Pack 4 More…Less

Symptoms

Consider the following scenario:

  • An application tries to connect to an instance of Microsoft SQL Server by using the Microsoft SQL Server Native Client 10.0 OLE DB provider.

  • The application uses the extended OLE DB initialization properties in the connection string. For example, the application uses the Server, Database, and FailOverPartner properties in the following connection string:

    Provider=SQLNCLI10.1;Integrated Security=SSPI; Server =<instance_name>; Database =<database_name>; FailOverPartner=<failover_partner_name>;


    Notes

    • <instance_name> is a placeholder that represents the name of the instance.

    • <database_name> is a placeholder that represents the name of the database.

    • <failover_partner_name> is a placeholder that represents the name of the failover partner.

In this scenario, the connection between the application and the instance of SQL Server is not created. Additionally, you receive the 10061 Windows sockets (Winsock) error code and the following error message:

No connection could be made because the target machine actively refused it.

Cause

This issue occurs because of an error in the SQL Server Native Client 10.0 OLE DB provider.

If you use extended OLE DB initialization properties for the SQL Server Native Client 10.0 OLE DB provider in the connection string, the connection string is encrypted. However, the extended properties might not be decrypted by the provider. For example, the Data Source and Initial Catalog names might not be decrypted by the provider. Therefore, you receive the error that is mentioned in the «Symptoms» section.

Resolution

Cumulative update information

SQL Server 2008 Service Pack 2

The fix for this issue was first released in Cumulative Update 3 for SQL Server 2008 Service Pack 2. For more information about this cumulative update package, click the following article number to view the article in the Microsoft Knowledge Base:

2498535 Cumulative update package 3 for SQL Server 2008 Service Pack 2Note Because the builds are cumulative, each new fix release contains all the hotfixes and all the security fixes that were included with the previous SQL Server 2008 fix release. Microsoft recommends that you consider applying the most recent fix release that contains this hotfix. For more information, click the following article number to view the article in the Microsoft Knowledge Base:

2402659 The SQL Server 2008 builds that were released after SQL Server 2008 Service Pack 2 was released Microsoft SQL Server 2008 hotfixes are created for specific SQL Server service packs. You must apply a SQL Server 2008 Service Pack 2 hotfix to an installation of SQL Server 2008 Service Pack 2. By default, any hotfix that is provided in a SQL Server service pack is included in the next SQL Server service pack.

SQL Server 2008 R2


The fix for this issue was first released in Cumulative Update 6. For more information about how to obtain this cumulative update package for SQL Server 2008 R2, click the following article number to view the article in the Microsoft Knowledge Base:

2489376 Cumulative Update package 6 for SQL Server 2008 R2 Note Because the builds are cumulative, each new fix release contains all the hotfixes and all the security fixes that were included with the previous SQL Server 2008 R2 fix release. We recommend that you consider applying the most recent fix release that contains this hotfix. For more information, click the following article number to view the article in the Microsoft Knowledge Base:

981356 The SQL Server 2008 R2 builds that were released after SQL Server 2008 R2 was released

SQL Server 2005 Service Pack 3

The fix for this issue was first released in Cumulative Update 14 for SQL Server 2005 Service Pack 3. For more information about this cumulative update package, click the following article number to view the article in the Microsoft Knowledge Base:

2489375 Cumulative update package 14 for SQL Server 2005 Service Pack 3Note Because the builds are cumulative, each new fix release contains all the hotfixes and all the security fixes that were included with the previous SQL Server 2005 fix release. Microsoft recommends that you consider applying the most recent fix release that contains this hotfix. For more information, click the following article number to view the article in the Microsoft Knowledge Base:

960598 The SQL Server 2005 builds that were released after SQL Server 2005 Service Pack 3 was released Microsoft SQL Server 2005 hotfixes are created for specific SQL Server service packs. You must apply a SQL Server 2005 Service Pack 3 hotfix to an installation of SQL Server 2005 Service Pack 3. By default, any hotfix that is provided in a SQL Server service pack is included in the next SQL Server service pack.

SQL Server 2008 Service Pack 1


The fix for this issue was first released in Cumulative Update 12 for SQL Server 2008 Service Pack 1. For more information about this cumulative update package, click the following article number to view the article in the Microsoft Knowledge Base:

2467236 Cumulative update package 12 for SQL Server 2008 Service Pack 1Note Because the builds are cumulative, each new fix release contains all the hotfixes and all the security fixes that were included with the previous SQL Server 2008 fix release. Microsoft recommends that you consider applying the most recent fix release that contains this hotfix. For more information, click the following article number to view the article in the Microsoft Knowledge Base:

970365 The SQL Server 2008 builds that were released after SQL Server 2008 Service Pack 1 was released Microsoft SQL Server 2008 hotfixes are created for specific SQL Server service packs. You must apply a SQL Server 2008 Service Pack 1 hotfix to an installation of SQL Server 2008 Service Pack 1. By default, any hotfix that is provided in a SQL Server service pack is included in the next SQL Server service pack.

SQL Server 2005 Service Pack 4

The fix for this issue was first released in Cumulative Update 2 for SQL Server 2005 Service Pack 4. For more information about this cumulative update package, click the following article number to view the article in the Microsoft Knowledge Base:

2489409 Cumulative update package 2 for SQL Server 2005 Service Pack 4Note Because the builds are cumulative, each new fix release contains all the hotfixes and all the security fixes that were included with the previous SQL Server 2005 fix release. Microsoft recommends that you consider applying the most recent fix release that contains this hotfix. For more information, click the following article number to view the article in the Microsoft Knowledge Base:

2485757 The SQL Server 2005 builds that were released after SQL Server 2005 Service Pack 4 was released Microsoft SQL Server 2005 hotfixes are created for specific SQL Server service packs. You must apply a SQL Server 2005 Service Pack 4 hotfix to an installation of SQL Server 2005 Service Pack 4. By default, any hotfix that is provided in a SQL Server service pack is included in the next SQL Server service pack.

Hotfix information

A supported hotfix is available from Microsoft. However, this hotfix is intended to correct only the problem that is described in this article. Apply this hotfix only to systems that are experiencing this specific problem.

If the hotfix is available for download, there is a «Hotfix download available» section at the top of this Knowledge Base article. If this section does not appear, submit a request to Microsoft Customer Service and Support to obtain the hotfix.

Note If additional issues occur or if any troubleshooting is required, you might have to create a separate service request. The usual support costs will apply to additional support questions and issues that do not qualify for this specific hotfix. For a complete list of Microsoft Customer Service and Support telephone numbers or to create a separate service request, visit the following Microsoft website:

http://support.microsoft.com/contactus/?ws=supportNote The «Hotfix download available» form displays the languages for which the hotfix is available. If you do not see your language, it is because a hotfix is not available for that language.

Prerequisites

To apply this hotfix, you must have SQL Server 2008 Service Pack 1 (SP1) installed.

Restart information

You may have to restart the computer after you apply this hotfix.

Registry information

You do not have to change the registry after you apply this hotfix.

Hotfix replacement information

This hotfix does not replace any other hotfixes.

File information

The English version of this hotfix has the file attributes (or later file attributes) that are listed in the following table. The dates and times for these files are listed in Coordinated Universal Time (UTC). When you view the file information, it is converted to local time. To find the difference between UTC and local time, use the Time Zone tab in the Date and Time item in Control Panel.

For all supported x86-based versions of SQL Server 2008

File name

File version

File size

Date

Time

Platform

sqlncli10.dll

2007.100.2806.0

2,560,872

14-Dec-2010

16:43

x86

Sqlncli_keyfile.dll

2007.100.2806.0

13,672

14-Dec-2010

15:30

x86

For all supported x64-based version of SQL Server 2008

File name

File version

File size

Date

Time

Platform

sqlncli10.dll

2007.100.2806.0

2,560,872

14-Dec-2010

16:43

x86

sqlncli10.dll

2007.100.2806.0

3,161,960

14-Dec-2010

23:45

x64

Sqlncli_keyfile.dll

2007.100.2806.0

14,184

14-Dec-2010

22:48

x64

For all supported IA-64-based versions of SQL Server 2008

File name

File version

File size

Date

Time

Platform

sqlncli10.dll

2007.100.2806.0

2,560,872

14-Dec-2010

16:43

x86

Sqlncli_keyfile.dll

2007.100.2806.0

13,672

14-Dec-2010

15:30

x86

Status

Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the «Applies to» section.

More Information

For more information about connection strings and OLE DB provider for SQL Server Native Client, visit the following Microsoft Developer Network (MSDN) website:

General information about connection strings and OLE DB provider for SQL Server Native Client

For more information about connection string syntax, visit the following MSDN website:

General information about the connection string syntax

For more information about OLE DB initialization properties, visit the following MSDN website:

General information about OLE DB initialization properties

Need more help?

On the client side:

  1. do not call WSACleanup() before calling connect().
  2. You are not doing any error handling on getaddrinfo().
  3. you are not setting the ai_flags to match your input values (like AI_NUMERICHOST).
  4. you are not freeing the memory that getaddrinfo() returns.
  5. you are not taking into account that you are specifying AF_UNSPEC to getaddrinfo() so it may return multiple addresses. You should try to connect to all of them until one succeeds.

Try this instead:

void Base::Connect(string ip, string port)
{
    int status, error;
    SOCKET ConnectSocket = INVALID_SOCKET;
    struct addrinfo hints = {0};
    struct addrinfo *servinfo;  // will point to the results

    hints.ai_family = AF_UNSPEC;     // don't care IPv4 or IPv6
    hints.ai_socktype = SOCK_STREAM; // TCP stream sockets
    hints.ai_flags = AI_NUMERICHOST; // parse an IP address
    //hints.ai_flags |= AI_NUMERICSERV; // parse a port number (not supported on Windows)

    // get ready to connect
    status = getaddrinfo(ip.c_str(), port.c_str(), &hints, &servinfo);
    if (status != 0)
    {
        printf("getaddrinfo error: (%d) %sn", status, gai_strerror(status));
        return;
    }

    addrinfo *addr = servinfo;
    do
    {
        // Socket Setup
        ConnectSocket = socket(addr->ai_family, addr->ai_socktype, addr->ai_protocol);
        if (ConnectSocket == INVALID_SOCKET)
        {
            printf("socket error: %dn", WSAGetLastError());
        }
        else
        {
            // Connect
            if (connect(ConnectSocket, addr->ai_addr, addr->ai_addrlen) != SOCKET_ERROR)
            {
                printf("connected to servern");
                break;
            }

            printf("connect error: %dn", WSAGetLastError());

            closesocket(ConnectSocket);
            ConnectSocket = INVALID_SOCKET;
        }

        addr = addr->ai_next;
    }
    while (addr != NULL);

    freeaddrinfo(servinfo);

    if (ConnectSocket == INVALID_SOCKET)
        printf("unable to connect to servern");
}

On the server side:

  1. you are not doing any error handling on socket(), bind() or listen().
  2. SO_REUSEADDR has to be enabled before calling bind(), not after. And you are not even enabling it correctly, either.
  3. you are not freeing the memory that getaddrinfo() returns.

Try this instead:

int _tmain(int argc, _TCHAR* argv[])
{
    // WINDOWS SETUP
    WSAData wsaData;
    if (WSAStartup(MAKEWORD(2, 0), &wsaData) != 0) 
    {
        fprintf(stderr, "WSAStartup failed.n");
        exit(1);
    }

    // PREPARE TO LAUNCH
    int status;
    struct sockaddr_storage their_addr;
    socklen_t addr_size;
    SOCKET client;

    struct addrinfo hints = {0};
    struct addrinfo *servinfo;  // will point to the results

    hints.ai_family = AF_UNSPEC;     // don't care IPv4 or IPv6
    hints.ai_socktype = SOCK_STREAM; // TCP stream sockets
    hints.ai_flags = AI_PASSIVE;     // fill in my IP for me
    //hints.ai_flags |= AI_NUMERICSERV; // parse a port number (not supported on Windows)

    status = getaddrinfo(NULL, "80", &hints, &servinfo);
    if (status != 0) 
    {
        fprintf(stderr, "getaddrinfo error: (%d) %sn", status, gai_strerror(status));
        getchar();
        exit(1);
    }

    // optional, loop through servinfo creating a separate
    // listening socket for each address reported...

    // GET THE FILE DESCRIPTOR  
    SOCKET mSocket = socket(servinfo->ai_family, servinfo->ai_socktype, servinfo->ai_protocol);
    if (mSocket == INVALID_SOCKET)
    {
        fprintf(stderr, "socket error: %dn", WSAGetLastError());
        freeaddrinfo(servinfo);
        closesocket(mSocket);
        getchar();
        exit(1);
    }

    // lose the pesky "Address already in use" error message
    BOOL yes = TRUE;
    if (setsockopt(mSocket, SOL_SOCKET, SO_REUSEADDR, (char*)&yes, sizeof(yes)) == SOCKET_ERROR)
    {
        fprintf(stderr, "setsockopt error: %dn", WSAGetLastError());
        freeaddrinfo(servinfo);
        closesocket(mSocket);
        getchar();
        exit(1);
    }

    // WHAT PORT AM I ON
    if (bind(mSocket, servinfo->ai_addr, servinfo->ai_addrlen) == SOCKET_ERROR)
    {
        fprintf(stderr, "bind error: %dn", WSAGetLastError());
        freeaddrinfo(servinfo);
        closesocket(mSocket);
        getchar();
        exit(1);
    }

    freeaddrinfo(servinfo);

    int backlog = 2;
    if (listen(mSocket, backlog) == SOCKET_ERROR)
    {
        fprintf(stderr, "listen error: %dn", WSAGetLastError());
        closesocket(mSocket);
        getchar();
        exit(1);
    }

    // SERVER STARTED LISTENING SUCCESFULLY
    printf("Server is listening...n");

    // ACCEPT
    addr_size = sizeof their_addr;
    client = accept(mSocket, (struct sockaddr*)&their_addr, &addr_size);
    if (client == INVALID_SOCKET)
    {
        fprintf(stderr, "accept error: %dn", WSAGetLastError());
    }
    else
    {
        char ip[NI_MAXHOST] = {0};
        char port[NI_MAXSERV] = {0};

        status = getnameinfo((struct sockaddr*)&their_addr, addr_size, ip, NI_MAXHOST, port, NI_MAXSERV, NI_NUMERICHOST | NI_NUMERICSERV);
        if (status == 0)
            printf("Client connected from %s:%sn", ip, port);
        else
            printf("Client connected. getnameinfo error: (%d) %sn", status, gai_strerror(status));

        //...

        closesocket(client);
    }        

    closesocket(mSocket);
    printf("Server ended");

    getchar();

    return 0;
}

Problem

When starting the sender, we get the following error (where XXX.XXX.XXX.XXX:XXXX is the IP Address and port number of the consuming system:

MsgSender ERROR MI_ConnectException: MI_TCPClientSocket::Connect() — Socket ‘XXX.XXX.XXX,XXX:XXXX connect failed with error 10061(common_socketMI_TCPClientSocket.cpp:104)

Resolving The Problem

The 10061 is a winsock connection error meaning the connection was refused. No connection could be made because the target machine actively refused it. This usually results from trying to connect to a service that is inactive on the foreign host i.e. one with no server application running.

Check that the ports are open and listening on the consuming system.

[{«Product»:{«code»:»SSLVY3″,»label»:»Initiate Master Data Service»},»Business Unit»:{«code»:»BU059″,»label»:»IBM Software w/o TPS»},»Component»:»Not Applicable»,»Platform»:[{«code»:»PF025″,»label»:»Platform Independent»}],»Version»:»Version Independent»,»Edition»:»»,»Line of Business»:{«code»:»LOB10″,»label»:»Data and AI»}}]

Понравилась статья? Поделить с друзьями:
  • Winsock connect error system error 10061 dameware
  • Winrm cannot process the request the following error occurred while using kerberos
  • Winsock connect error system error 10060 dameware
  • Winrar просит купить лицензию как исправить
  • Winsetupfromusb как изменить меню