Resource icon

Fixing the ‘Failed to Connect Socket: Connection Timed Out’ Error

When sending emails, you may encounter the ‘Failed to Connect Socket: Connection Timed Out’ error. As you may know, connection timed out errors are when the server either doesn’t respond or takes too much time to respond. In this article, learn what exactly the ‘Failed to Connect Socket’ error is and how to fix it.

What is Failed to Connect Socket: Connection Timed out Error?

In simple terms, socket is the endpoint of communication. When the mail needs to be sent, the socket of the client connects to the listening server socket. The mail will be sent only when the connection is established.

The ‘Failed to Connect Socket: Connection Timed Out’ error usually means that the connection attempt to listening socket failed.

How to Fix this Error?

There are multiple reasons why the connection to the listening socket may fail. How you fix the error depends on the exact reason for the failure. Here are the main reasons for this error along with the fixes:

Wrong SMTP host and port

Users are required to provide mail server details in their email application. This includes SMTP host and port number.

If you’re using Gmail as your email server, the SMTP host needs to be smtp.gmail.com. If there’s a typo in the SMTP host name, it will lead to the error.

Likewise, the default SMTP port is 25. But email providers change the value to 587 to reduce spam messages. On top that, mail server’s process emails only when there’s a SSL port 465.

Deviation from any of the above values will result in ‘Failed to Connect Socket’ error.

Solution

First, you need to check for the DNS connectivity of the mail server. Use this command for this purpose:

Code:
dig mail.domain.com
Then, use the following command to find the correct SMTP port and the connectivity:

Code:
telnet mail.domain.com 25
Finally, verify the SMTP settings and make adequate changes.

There’s restriction in Server firewall

Almost all admin use some sort of firewall to keep their servers and ports safe. But it does lead to some problems. It can block access from reliable IP address if there’s an abnormal behavior. If the firewall detects such behavior, it will restrict access and users are like to see the ‘failed to connect socket connection timed out’ error.

Solution

To fix the firewall-related issue, you need to verify if the IP address has been blocked in the server firewall. Use tools like whatismyipaddress.com to check the users’ public IP address.

If it is blocked by the firewall, then remove it from the list or restore the email connectivity. You can also whitelist the IP address so the firewall doesn’t block it in the future.

The ISP Port blocks

If you’re on the default Port 25, you should know that most ISPs block it to prevent spam. So the connection will get timed out.

Solution

The first thing to check is the ‘traceroute’ results from the mail server to the user’s system. It’d list all the network-related connectivity issues that are present in any intermediateries, including the ISP. If the ISP has blocked the connection, the user should contact them and let them know about the issue.

Alternatively, you can configure the mail server to a different port and override the ISP port blocks.

Once you’ve re-configured the mail server, add the IP address to the whitelist.

Firewalls on the system

Our systems have their own firewall system to combat spam. It’s provided in the anti-virus software. If activated, they can block certain IP addresses as well.

Solution

To check if the firewall of the PC of laptop is causing the error, open the ‘telnet’ results. If there are any system firewall related issues, disable the local firewall. Or if there are any white listing option, try it. It should fix the issue.

So that’s how you solve the ‘Failed to Connect Socket: Connection Timed Out’ error. For more assistance, get in touch with the support team.
Author
kumkumsharma
Views
14,358
First release
Last update
Rating
0.00 star(s) 0 ratings

More resources from kumkumsharma

Top