SMTP and POP3 Healthy

T

Thom Little

I want to check if a remote server is healthy. For FTP and HTTP ports I
use ...

public static string Connect( string hoist, int port )
{
try
{
IPAddress[] ipa = Dns.GetHostAddresses( host );
Socket s = new Socket( AddressFamily.InterNetwork, SocketType.Stream,
ProtocolType.Tcp );
s.Connect( ipa[0], port );
}
catch
{
return (host + ":" + port.ToString( ) + " " );
}
return ( null );
}

.... this same technique for SMTP and POP3 always reports success.

How can I remotely test SMTP and POP3 to determine if they are healthy
(i.e., not hung)?

_______________________________________________
Thom Little www.tlanet.net Thom Little Associates, Ltd.
 
B

Ben Voigt

Thom Little said:
I want to check if a remote server is healthy. For FTP and HTTP ports I
use ...

You have to define "healthy" better. You are currently testing only the
transport layer (is the TCP/IP stack responding, and the connection queue
isn't overfull). The OS will hold the connection open until the app is
ready to handle it. It sounds as if you want to also test the application
layer, which requires sending a message from the appropriate protocol. For
SMTP that would probably be "EHLO\r\n", and you should get a response
beginning with 3 digits indicating success or failure. Not responding to
the protocol level command would also be considered a failure. To find out
if your authentication database is responding, you may have to go further
and actually login as a particular user.
public static string Connect( string hoist, int port )
{
try
{
IPAddress[] ipa = Dns.GetHostAddresses( host );
Socket s = new Socket( AddressFamily.InterNetwork, SocketType.Stream,
ProtocolType.Tcp );
s.Connect( ipa[0], port );
}
catch
{
return (host + ":" + port.ToString( ) + " " );
}
return ( null );
}

... this same technique for SMTP and POP3 always reports success.

How can I remotely test SMTP and POP3 to determine if they are healthy
(i.e., not hung)?

_______________________________________________
Thom Little www.tlanet.net Thom Little Associates, Ltd.
 
T

Thom Little

I'll try to be more precise ...

For an SMTP port serving multiple users ... some user is able to submit
messages for transmission. (A problem with an individual user is ignored.)

For a POP3 port serving multiple users ... some user is receiving messages.
(A problem with an individual user is ignored.)

_______________________________________________
Thom Little www.tlanet.net Thom Little Associates, Ltd.

You have to define "healthy" better.
 
B

Ben Voigt

Thom Little said:
I'll try to be more precise ...

For an SMTP port serving multiple users ... some user is able to submit
messages for transmission. (A problem with an individual user is
ignored.)

For a POP3 port serving multiple users ... some user is receiving
messages.
(A problem with an individual user is ignored.)

Then you should try to do just that. Read the RFCs or get a packet capture
of a typical transaction to find out what to send the server. Or you could
always use an existing program that does the same thing, I've had a lot of
luck with Servers Alive? from woodstone.nu, other less expensive (even free)
products have come out since we chose them.

Maybe even better, create a dummy user with a strong random password, send
it a message and see if you can download it via POP3. Parse out some of the
MIME headers, like Received, and you even get an accurate real-time
indication of the latency.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top