0 votes
by (270 points)

Using Rebex 2016 R3

I'm setting the Timeout property of the Rebex.Net.Smtp client to 90000, yet I'm still seeing calls to Connect failing within 23-25 seconds.

2017-10-18 10:24:14.445 INFO :[14] Info: Connecting to 68.87.20.5:25 using Smtp 2.0.6198.0.

2017-10-18 10:24:37.950 ERROR :[14] Info: Rebex.Net.SmtpException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. ---> Rebex.Net.ProxySocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. ---> Rebex.Net.ProxySocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. ---> System.Net.Sockets.SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 68.87.20.5:25
at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
at System.Net.Sockets.Socket.Connect(EndPoint remoteEP)
at Rebex.Net.IYL.WF(String C, IPAddress D, Int32 L)

Applies to: Rebex Secure Mail

1 Answer

0 votes
by (3.9k points)

Hello,

The Timeout property is used to define maximum timeout value, not minimum. That is why you might receive error message even earlier than 90 seconds.

In this case, the problem occurred at the TCP transport layer, which has it's own system-wide timeout settings unrelated to the Timeout property.

by (270 points)
That doesn't make any sense. If I'm using a client library for SMTP and I set a timeout, it should use it/pass it along. If I connect with PUTTY to the mail server to test/verify, I can clearly see that it connects after 20 seconds. So how do I control the timeout for SMTP Connect?
by (148k points)
Perhaps PuTTY is doing something slightly different, such as connecting to a different IP (for multi-ip hostnames) or to an IPv6 address. We can look into that, but first, please try running the following code:

using System.Net.Sockets;
...

using (var s = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp))
{
    s.ReceiveTimeout = 90000;
    s.SendTimeout = 90000;
    s.Connect("68.87.20.5", 25);
}

Does this time out (and when), or does it succeed?
...