Меню

Ошибка 10051 network is unreachable

A socket error, such as socket error 10051, occurs whenever one computer attempts to connect to another network or server. Error 10051 happens because the other network is unreachable, usually because there is a problem with the router or modem on the computer attempting the connection. This can be as harmless as the router being shut off or a firewall getting in the way. At the serious end of the spectrum, the router may be misconfigured or may have been destroyed and is nonfunctioning.

Whenever a connection cannot be made, such as in the case of socket error 10051, one of the most common culprits is a firewall program. Though made to keep the computer safe, a firewall may restrict friendly connections. One should disable the firewall and see if the connection can go through. If the socket error still appears, then the firewall is not at fault.

Socket error 10051 is commonly caused by problems with a router or modem.

Socket error 10051 is commonly caused by problems with a router or modem.

If the router or modem is down, then there is no way for the computer to connect to another server. Someone may have bumped into the router or meant to reset the router and never turned it back on. Turning the router back on should restore the Internet server and allow the computer to connect to a server. If the router has been damaged, by being hit or having liquid spilled on it, for example, the router may need to be completely replaced.

A misconfigured router can cause socket error 10051. The misconfiguration means the router believes it cannot communicate with the server, so it doesn’t attempt the connection. Some advanced users may be able to find the problem, but it is best to call the Internet provider and get someone there to check out the router configuration. The provider will be able to find the problem and will tell the user how to fix it.

Some users have more than one router active at the same time. If there is more than one, one portion of the computer may believe it has to talk with one router, while another section believes another router has to be used. In this instance, neither router is designated as the primary router so neither will work. Configuring the computer to speak with only one router will alleviate this problem.

A similar problem that some users believe can cause socket error 10051 is when the computer is told not to use any router. This would cause the network to be unreachable, but it yields a different socket error. When the computer doesn’t have any router configured, this returns a socket error 10065.

I get an 10051 socket error every time I try to use this code:

    USES_CONVERSION;
LPTSTR addr = A2W("192.168.1.209");
m_pSMACLPRCli = new CSMACLPRCli(addr, 12010, m_hWnd);
m_pSMACLPRCli->StartThread();

This is the constructor for m_pSMACLPRCli:

CSMACLPRCli::CSMACLPRCli(LPTSTR lpsztIPAddress, int nPort, HWND hParentWnd)

And this is how I create the socket and connect:

void CBlockingSocket::Create(int nType /* = SOCK_STREAM */)
{
    ASSERT(m_hSocket == NULL);
    if ((m_hSocket = socket(AF_INET, nType, 0)) == INVALID_SOCKET)
    {
       TRACE("n Socket Error !1 (%d)n", WSAGetLastError());
       int err = WSAGetLastError();
}
}


BOOL CBlockingSocket::Connect(LPCSOCKADDR psa)
{
   ASSERT(m_hSocket != NULL);
   // should timeout by itself
   if (connect(m_hSocket, psa, sizeof(SOCKADDR)) == SOCKET_ERROR)
   {
       int nLastErr = WSAGetLastError();
       return FALSE;
   }

   return TRUE;
}

The real funny thing is that when I use the exact same code, class structure etc. in a VS2008 project, everything works as expected, but when I use it in a VS2010 project, at connect() I get a 10051 error, Network is unreachable.

EDIT: The original VS2010 proj. is compiled using UNICODE. I’ve made a new VS2010 using MULTI-BYTE for testing and the connect() method returns no error, and … connects. Could it be something wrong with my way of passing the address string to the constructor?

USES_CONVERSION;
LPTSTR addr = A2W("192.168.1.209");
m_pSMACLPRCli = new CSMACLPRCli(addr, 12010, m_hWnd);
m_pSMACLPRCli->StartThread();

SOLVED:

The real problem was not the connect() method, but had to do with my way of passing the address string to a constructor of a sockaddr object.

The constructor:

CSockAddr(const char *pchIP, const USHORT ushPort = 0) // dotted IP addr string
{
    sin_family = AF_INET;
    sin_port = htons(ushPort);
    sin_addr.s_addr = inet_addr(pchIP);
}

Constructor call used by me:

 CString m_strSrvIPAddr;    
 CSockAddr saServer((char *) LPTSTR(LPCTSTR(m_strSrvIPAddr)), USHORT(m_nPort));

I changed the call to this:

CStringA strAddr(m_strSrvIPAddr);
CSockAddr saServer((const char *) strAddr, USHORT(m_nPort));

So I had to do a conversion of the string from UNICODE to MULTI_BYTE.

spydark91

86 / 86 / 13

Регистрация: 03.03.2011

Сообщений: 1,873

1

02.06.2011, 16:38. Показов 6841. Ответов 24

Метки нет (Все метки)


написал самый простенький код для отправки письма

Delphi
1
2
3
4
5
6
7
8
9
10
11
12
13
14
procedure TForm1.Button1Click(Sender: TObject);
begin
IdSMTP1.Host:='smtp.yandex.ru';
IdSMTP1.Port:=25;
IdSMTP1.Username:='lcrnt50476ythmdfhg8ygzhge';
IdSMTP1.Password:='skzifyb74rty.lzifl,z';
 
IdMessage1.Body.Text:='gbcmvj';
IdMessage1.From.Text:='********@yandex.ru';
IdMessage1.Recipients.EMailAddresses:='*********@mail.ru';
IdMessage1.Subject:='ntvf';
IdSMTP1.Connect();
IdSMTP1.Send(IdMessage1);
IdSMTP1.Disconnect;

дает ошибку через секунд 10 (скрин)

Миниатюры

Socket error #10051: Network is unreacheable
 

__________________
Помощь в написании контрольных, курсовых и дипломных работ, диссертаций здесь



0



86 / 86 / 13

Регистрация: 03.03.2011

Сообщений: 1,873

02.06.2011, 17:11

 [ТС]

2

хоть он и дает ошибку что интернета нет,но он ест,как я тогда на форуме сижу)



0



86 / 86 / 13

Регистрация: 03.03.2011

Сообщений: 1,873

03.06.2011, 19:06

 [ТС]

3

никто не знает..



0



igoriy

873 / 544 / 117

Регистрация: 24.11.2009

Сообщений: 1,329

03.06.2011, 19:23

4

вот мой код который я только что проверил — попробуй у себя

Delphi
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
begin
     IdSmtp1.Host:= 'smtp.mail.ru';
     IdSmtp1.Port := 25;
     idSmtp1.Username := '*****';
     idSmtp1.Password := '*****';
     IdMessage1.ContentType:='text/plain'; // Письмо в текстовом виде
     idMessage1.Body.Text := Memo1.Text;
     idMessage1.From.Text :='****@mail.ru';
     idMessage1.Recipients.EMailAddresses := '****@mail.ru';
     idMessage1.Subject := 'Tect';
     idmessage1.ContentType:='text/html; charset=windows-1251';
     idmessage1.ContentTransferEncoding:='8bit';
     idSmtp1.Connect;
     if idSmtp1.Connected = TRUE then
     idSmtp1.Send(idMessage1);
     idSmtp1.Disconnect();
end;



0



spydark91

86 / 86 / 13

Регистрация: 03.03.2011

Сообщений: 1,873

03.06.2011, 20:11

 [ТС]

5

та же самая ошибка((

Добавлено через 39 секунд
ошибка на строке

Delphi
1
2
   if idSmtp1.Connected = TRUE then
    ;



0



873 / 544 / 117

Регистрация: 24.11.2009

Сообщений: 1,329

03.06.2011, 20:12

6

Тогда не знаю.Проверил еще раз — работает



0



86 / 86 / 13

Регистрация: 03.03.2011

Сообщений: 1,873

03.06.2011, 20:12

 [ТС]

7

может это изза роутера?хотя он тут вроде непричем..



0



873 / 544 / 117

Регистрация: 24.11.2009

Сообщений: 1,329

03.06.2011, 20:13

8

да нее



0



86 / 86 / 13

Регистрация: 03.03.2011

Сообщений: 1,873

03.06.2011, 20:16

 [ТС]

9

скинь свой exe шник

Добавлено через 41 секунду
поменял порт на 2525 ошибка на последней строке..



0



873 / 544 / 117

Регистрация: 24.11.2009

Сообщений: 1,329

03.06.2011, 20:17

10

давай я исходник пришлю — ехешником ты будешь отправлять сообщения с моего ящика на другой мой ящик



0



spydark91

86 / 86 / 13

Регистрация: 03.03.2011

Сообщений: 1,873

03.06.2011, 20:24

 [ТС]

11

а,ну давай)

Добавлено через 2 минуты
может я чет не правильно тут указываю? ща все подпишу

Delphi
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
 IdSmtp1.Host:= 'smtp.mail.ru';
     IdSmtp1.Port := 25;
     idSmtp1.Username := '*****';//например усли у меня адрес [email]asdfg@mail.ru[/email] ,то тут я указываю asdfg
     idSmtp1.Password := '*****';//пароль от мыла
     IdMessage1.ContentType:='text/plain'; // Письмо в текстовом виде//для чего эта строка?
     idMessage1.Body.Text := Memo1.Text;
     idMessage1.From.Text :='****@mail.ru';//от кого пришло,те указываю [email]asdfg@mail.ru[/email]
     idMessage1.Recipients.EMailAddresses := '****@mail.ru';//кому посылаю
     idMessage1.Subject := 'Tect';
     idmessage1.ContentType:='text/html; charset=windows-1251';//для чего?
     idmessage1.ContentTransferEncoding:='8bit';//для чего?
     idSmtp1.Connect;
     if idSmtp1.Connected = TRUE then
     idSmtp1.Send(idMessage1);
     idSmtp1.Disconnect();

Добавлено через 2 минуты
может у меня провайдер 25 порт блокирует?
потому что на порте 2525 ошибка другая)

Добавлено через 17 секунд
и на 587 тоже другая(как на 2525)



0



igoriy

873 / 544 / 117

Регистрация: 24.11.2009

Сообщений: 1,329

03.06.2011, 20:27

12

вот

Delphi
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
begin
     IdSmtp1.Host:= 'smtp.mail.ru';
     IdSmtp1.Port := 25;
     idSmtp1.Username := 'vasya';// с какого ящика отправляешь
     idSmtp1.Password := 'пароль';
     IdMessage1.ContentType:='text/plain'; // Письмо в текстовом виде
     idMessage1.Body.Text := Memo1.Text;
     idMessage1.From.Text :='vasya@mail.ru';
     idMessage1.Recipients.EMailAddresses := 'roma@mail.ru';// куда отправляешь
     idMessage1.Subject := 'Tect';
     idmessage1.ContentType:='text/html; charset=windows-1251';
     idmessage1.ContentTransferEncoding:='8bit';
     idSmtp1.Connect;
     if idSmtp1.Connected = TRUE then
     idSmtp1.Send(idMessage1);
     idSmtp1.Discon



0



873 / 544 / 117

Регистрация: 24.11.2009

Сообщений: 1,329

03.06.2011, 20:29

13

вот исходник



0



86 / 86 / 13

Регистрация: 03.03.2011

Сообщений: 1,873

03.06.2011, 20:42

 [ТС]

14

на найден [Fatal Error] Unit1.pas(8): File not found: ‘IdExplicitTLSClientServerBase.dcu’



0



873 / 544 / 117

Регистрация: 24.11.2009

Сообщений: 1,329

03.06.2011, 20:43

15

а у тебя какая дельфя?



0



86 / 86 / 13

Регистрация: 03.03.2011

Сообщений: 1,873

03.06.2011, 20:44

 [ТС]

16

делфи 7



0



873 / 544 / 117

Регистрация: 24.11.2009

Сообщений: 1,329

03.06.2011, 20:45

17

а у меня 2010 — может в этом и причина



0



86 / 86 / 13

Регистрация: 03.03.2011

Сообщений: 1,873

03.06.2011, 20:59

 [ТС]

18

я писал свой код по видео уроку,так что мой должен работать
а ошибка и при моем и при твоем одинаковая..

Добавлено через 12 минут
получать письма,он получает..
может есть другой спобос отправки?



0



873 / 544 / 117

Регистрация: 24.11.2009

Сообщений: 1,329

03.06.2011, 21:04

19

я в этом не силен



0



86 / 86 / 13

Регистрация: 03.03.2011

Сообщений: 1,873

03.06.2011, 22:03

 [ТС]

20

что ззначит такая ошибка —syntactically invalid EHLO argument(синтаксически недействительный аргумент EHLO)

Добавлено через 15 минут
как переименовать имя компа?



0



I am running an OpenVPN 2.4.9 server (without Access web interface) on a CentOS 7 machine for ~30 employees using Windows 10 laptops.

Recently, I noticed some people were disconnecting with UDP error 10051 after a few minutes of being connected. This error only occurs once in a while and always at the same clients and disappears after rebooting the operating system or after waiting an undefined amount of time.

According to Microsoft’s documentation this error is indicating that it cannot reach the network.

The clients can still use other networking functions (i.e. browsing the web) so general internet connectivity is available and the windows firewall is not configured to block the port I am using (otherwise the connection couldn’t have been established in the first place,right?). There are no firewalls or other middleboxes other than the windows firewall between the server and it’s clients.

Is there any advice that can be given to solve this riddle?

Server config:

user nobody
group nobody    
persist-key
persist-tun
port 1094   
proto udp
proto udp6
dev tun

ca easy-rsa/pki/ca.crt
cert c.crt
key c.key
dh dh.pem

cipher AES-256-CBC
auth SHA512
comp-lzo
reneg-sec 0
inactive 0
keepalive 10 36000

Client config:

client 

dev tun
remote vpn.domain.tld 1094
comp-lzo

ca a/ca.crt
cert a/d.crt # EasyRSA generated
key a/d.key

auth-nocache
auth-user-pass
cipher AES-256-CBC
auth SHA512
remote-cert-tls server
reneg-sec 36000

When I tried to connect to an FTP server using filezilla it was showing an error.

*connection attempt failed with "10051".
Could not connect to server.*

What error is this and how can I solve this problem?

A. Prasad's user avatar

A. Prasad

8013 gold badges14 silver badges30 bronze badges

asked Jul 9, 2014 at 8:27

user3744406's user avatar

See What Are the Common Causes of Socket Error 10051?

A socket error, such as socket error 10051, occurs whenever one computer attempts to connect to another network or server. Error 10051 happens because the other network is unreachable, usually because there is a problem with the router or modem on the computer attempting the connection.

answered Jul 9, 2014 at 8:31

SPRBRN's user avatar

SPRBRNSPRBRN

7,08213 gold badges59 silver badges90 bronze badges

3

Socket error is kind of a common error we often face while using the internet for connecting to another computer, sending mails or just browsing. There are several errors having identical codes.

Sometimes the problem occurs because of our firewall and antivirus settings; sometimes the server or the computer we are trying to connect to reports an error. Basically there are lots of errors like this. Here we are giving some errors and their solutions.

Socket Error 10053

This error message reports “Software caused connection abort”.

Cause

There are several things that cause this error to happen.

  1. The established connection may be aborted by software. This can be possibly done by an antivirus program.
  2. Not only the software, it can also happen by network problem or server problem.
  3. If the port is inactive for a long time, the problem may arise.
  4. The MTU (Maximum Transmission Unit) settings can also create the problem.

Solutions

As the problems are widespread, the solutions are also quite dependent on the type of problem.

  1. If the problem is caused by the VPOP3 client while downloading or sending mail, then the antivirus program can cause the problem. Generally McAfee VirusScan 8 and Norton Antivirus 2004 is the reason behind the error. Also other antivirus programs can create the problem.
  2. If a VPOP3 client has stopped working due to some other reason,we have to wait till it gets fixed.
  3. In the case of MTU settings problems, the large value of MTU can be a cause to discard the message in the network. So we have to set the MTU value at 1432 and the MSS (Maximum Segment Size) must be set to 0 or to auto adjust.

Socket Error 10061

socket error 10061connection refused image

This error report says “Connection refused”.

Cause

There are quite a few reasons for this problem.

  1. The target computer may have refused the connection. This happens when the computer is not connected to any running server application.
  2. Sometimes the destination mail server is refusing to receive mail. The spam filter is preventing the mail from being received. This means the SMTP server is sending junk mails.
  3. The firewall can also block the new connection attempt. The Port 25 (needed for SMTP) and the Port 110 (needed for POP) are blocked by the firewall.
  4. The ISP can also be too busy to accept any new connection.

Solutions

There are couple of solutions for this error.

  1. If the error is reported during sending an email then the SMTP has an error. Maybe we have sent too much mail during a short period to the destination mail. So the destination mail server reported the sending mail server as spam. In this context, we can reduce the frequency of sending mail to the mail server. Also we can send the mail via relay server. But the use of the relay server is not quite secure to use as it’s used by spammers.
  2. We can disable the firewall for some period and try to send mail to the destination mail server. If it succeeds then we can be sure that the firewall is creating the problem. So we can add exceptions for the connection in the firewall.

Socket Error 10049

This error report says “Cannot assign requested address”.

Cause

The main reason behind this error is that the address entered is invalid in the IP address. It happens to bind the address which is not valid in the local computer address. Timing issues in the DNS lookup can also create this error.

Solutions

The solutions for this problem are quite limited.

  1. Sometimes the reason behind this problem is the firewall. So if we put the host for our server in the firewall (it can be our system firewall or the antivirus firewall), it can solve the problem.
  2. Also if we forward the port in the internal IP of the new PC which we are trying to connect, it can resolve the problem.
  3. For the timing issue in the DNS lookup we have to follow some tiny steps. In the ‘Diagnostics’ tab in the VPOP3 we have to press ‘TCP/IP Tuning Option’ button and tick the ‘Use synchronous DNS’.

Socket Error 10051

The error report says “Network is unreachable”.

Cause

There are several reasons behind the problem.

  1. The internet connection may be down so the router can find a way to send the data to the destination.
  2. The router may be misconfigured so the router is not able to communicate with the target server.
  3. The firewall may be blocking port 25, which is used for the SMTP client connection to send mails.
  4. If we have two or more routers connected then windows may be misconfigured to communicate.

Solutions

The solutions for this problem are quite simple.

  1. The ISP sometimes blocks port 25 to control the spam through their servers. So we can call them to unblock port 25 and also we can use their own SMTP server.
  2. If the firewall is blocking port 25 then we can add an exception for the port in the settings of firewall.

Socket Error 11004

socket errors

The error report says “Valid name, no data of requested type”. The requested name is valid and was found in the database, but it does not have the correct associated data being resolved for.

Solutions

  1. As the error is associated with DNS so first of all check whether the address typed is correct or not.
  2. Try to connect with the IP address instead of Domain name. Ping the domain name in the command prompt to get the IP address of the domain name.
  3. We also have to be sure that the firewall or any antivirus program isn’t blocking the ports.
  4. A registry scan may help in this context. Any reliable registry scanner software can do the job.

Socket Error 10013

The error message says “Permission denied”.

Cause

An attempt was made to access a socket in a way forbidden by its access permissions. An example is using a broadcast address for sendto without broadcast permission being set using setsockopt (SO_BROADCAST).

Another possible reason for the WSAEACCES error is that when the bind function is called, another application, service, or kernel mode driver is bound to the same address with exclusive access. Such exclusive access is a new feature of Windows NT 4.0 with SP4 and later, and is implemented by using the SO_EXCLUSIVEADDRUSE option.

Solutions

  1. Check the firewall settings whether it is blocking the port 25 or not. If yes then disable the firewall for some time and check whether the same error persists or not. Then we have to change the firewall settings so that it doesn’t block port 25.
  2. A registry scan may help in this context. Any reliable registry scanner software can do the job.

Socket Error 10060

The error report says “Connection timed out”. It means that the connected host failed to respond or the connection failed after some period of time.

Solutions

  1. The error simply means that the SMTP server needs authentication. So if we are using Outlook Express then we should check the box ‘My server requires authentication’.
  2. The firewall may also be blocking the connection. Disabling the firewall may resolve the error.
  3. The SMTP server may also be blocked. So contacting ISP may resolve the problem.

0 0 голоса
Рейтинг статьи
Подписаться
Уведомить о
guest

0 комментариев
Старые
Новые Популярные
Межтекстовые Отзывы
Посмотреть все комментарии

А вот еще интересные материалы:

  • Яшка сломя голову остановился исправьте ошибки
  • Ясность цели позволяет целеустремленно добиваться намеченного исправьте ошибки
  • Ясность цели позволяет целеустремленно добиваться намеченного где ошибка
  • Ошибка 1005 пара па
  • Ошибка 1002 clack как сбросить