A socket error 10061 is a connection that is refused or forcefully denied. While this error can technically be seen with any type of server connection, it is most often seen when a user attempts to connect to an email server. There are many reasons for a socket error 10061. A firewall could be blocking the connection, the service may be unavailable, the server program making the server work may be disabled or shut off, the servers may be overloaded, or the ports may be blocked. Each cause has a different fix that should allow the user to connect to the server.
The socket error 10061 code can appear whenever a user connects to a server. This is most often seen with email servers, because the most common server connection users encounter is one used with an email service. Computers that link to other servers, such as for business uses, may also see this problem. Regardless of how the error is caused, it still has the same common causes and fixes.
A firewall blocking the connection and causing a socket error 10061 is the easiest to fix. Firewalls keep malicious codes or connections from occurring, but a firewall sometimes gets confused and also blocks good connections. This most often happens if the user is connecting to a server for the first time or if the firewall was recently reset. In this instance, the user either has to list the server as friendly or shut down the firewall. If the firewall needs to be shut down, the user should put it back up after the server connection is finished.
Another cause for a socket error 10061 is a blocked port or ports. Ports need to be open for sockets to connect. Each server will require a different port, and each program will have a different way of opening ports. To fix this error, the user should contact the server’s customer service to see what ports are needed, and read the user manual or talk to customer service about how to open the specified port or ports.
The other causes, which cannot be controlled by the user, include a server being unavailable, the server program not running, and the server being overloaded. In these cases, the server must be repaired or turned on, or the user must wait until the busy surge has stopped and bandwidth has been freed up. In this instance, the user may wait from a few minutes to a few hours; in catastrophic instances days, may be needed to connect with the server.
-
Daulet
- Сообщения: 7
- Зарегистрирован: 08 сен 2017, 08:25
Ошибка подключения (Socket Error # 10061 Connection refused.)
Здравствуйте! Проблема в том что, при опросе устройств micom через moxa nport, lectus выдает ошибку «Ошибка подключения (Socket Error # 10061 Connection refused.)». Устройства опрашиваются удаленно с другого города. По месту опрашивает те же устройства другой OPC сервер, там опрос идет нормально. Установлен Lectus v3.9 сборка 133.
Файлы *.cfg, *.log, *.txt выслал на почту тех. поддержки lectussoft@gmail.com.
-
admin
- Администратор
- Сообщения: 578
- Зарегистрирован: 05 сен 2010, 00:51
Re: Ошибка подключения (Socket Error # 10061 Connection refused.)
Сообщение
admin » 08 сен 2017, 11:27
1) Это проблема на уровне канала связи.
Сервер не может подключиться по TCP.
2) Для проверки связи, на проблемном компьютере запустите telnet клиент и задайте IP адрес и TCP порт, для проверки соединения.
Например: telnet 192.168.116.52 4003
Если идет нормальное подключение, то появится черный экран, иначе выйдет сообщение об ошибке.
-
admin
- Администратор
- Сообщения: 578
- Зарегистрирован: 05 сен 2010, 00:51
-
Daulet
- Сообщения: 7
- Зарегистрирован: 08 сен 2017, 08:25
-
admin
- Администратор
- Сообщения: 578
- Зарегистрирован: 05 сен 2010, 00:51
Написать сообщение
Сообщение будет добавлено в самый конец дискуссии
Oleg
26 апреля 2013, 14:04#
Установил на компьютер руководителя «Серверную часть» на свою машину клиентскую, при попытке подключится к базе данных выдаёт окно: «socket error 10061 connection refused».
IP в настройках вбиты. Порт вбит.
Не сильно шарю в сетях, но думаю что проблем с подключением нет, ибо была проблема (отсутствовал доступ к компу руководителя через «Компьютеры рабочей группы» в «Сетевые окружения») которую я более менее настроил
Windows XP SP2.
Что делать? как быть? работа стоит…
Oleg
26 апреля 2013, 14:04#
Антивирус удалён.
Брандмауэр отключен.
Oleg, Ваше письмо передали техническим специалистам. Вам ответят по электронной почте.
<Егор>
17 июля 2013, 22:07#
18.07.2013 4:17:16 — Log — Ошибка подключения к серверу!
18.07.2013 4:17:16 — Log — Error:Socket Error # 10061 Connection refused. что это такое и как решить эту проблему
<Егор>, опишите Вашу проблему в письме и отправьте на почту 3@375.ru
<Дмитрий>
10 октября 2016, 15:10#
Возникла такая же проблема как у Олега ранее, что делать?
<Дмитрий>, опишите проблему в письме и отправьте на почту all@pvision.ru.
<ктото>
23 января 2017, 19:01#
Error:Socket Error # 10061 Connection refused — говорит о том что сервер к которому вы подлючаетесь, сам сбрасывает подключение. Здесь несколько вариантов:
1. Переполнена очередь запросов, либо достигнут лимит подключений.
2. Подключение блокирует какая то из систем защиты, фаервол; антивирус; Брэндмауэр Виндовс и т.д.
3. Сервер выключен
4. Закрыт порт(если доступ запрашивается через роутер)
Updated October 13, 2022 13:27
During log on to the Enterprise Server using the Password Depot client, you receive the error message «Socket Error #10061 — Connection Refused».
If the connection is rejected, this generally has something to do with the fact that there is no such connection on the port or the connection cannot be detected.
This can have different reasons:
- The service is not running: Please make sure that the server service is running properly (you can check that in the Windows services dialog window, the server service is called Password Depot Enterprise Server).
- Firewall: Please make sure that your firewall, both on the client and server computer, explicitly shares the client and server program files as well as the IP address and port number.
- Wrong port: Please make sure that you are using the correct port number and that it is enabled in the firewall (for both inbound and outbound connections,TCP and UDP protocols). By default, all major versions of the Enterprise Server use a different port number.
- Wrong SSL settings: Please make sure to use the same SSL settings on both the client and server. For more information about using a SSL certificate on the server and the according connections, please click here.
- DNS errors: Usually, when connecting to the server, you can avoid DNS errors by using the server’s IP address instead of a server name.
On the client side:
- do not call
WSACleanup()
before callingconnect()
. - You are not doing any error handling on
getaddrinfo()
. - you are not setting the
ai_flags
to match your input values (likeAI_NUMERICHOST
). - you are not freeing the memory that
getaddrinfo()
returns. - you are not taking into account that you are specifying
AF_UNSPEC
togetaddrinfo()
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:
- you are not doing any error handling on
socket()
,bind()
orlisten()
. SO_REUSEADDR
has to be enabled before callingbind()
, not after. And you are not even enabling it correctly, either.- 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;
}