Zip Component, Email Component, Encryption Component ActiveX Control for Zip Compression .NET Components for ASP.NET
ActiveX and .NET Components for Zip Compression, Encryption, Email, XML, S/MIME, HTML Email, Character Encoding, Digital Certificates, FTP, and more ASP Email ActiveX Component

Index of Chilkat Blog Posts

March 15, 2007

How to Verify Connectivity with POP3, SMTP, FTP, IMAP, etc.

The Chilkat components share the same underlying TCP/IP socket code, so when there’s a connectivity problem with a server (i.e. a TCP/IP connection cannot be established), you’ll see the following tell-tale phrases in your LastErrorText:

socket is not ready for writing
Connect function failed.
SocketError: WSAEWOULDBLOCK The socket would block.

You can verify connectivity with a server by opening a DOS command prompt and issuing a telnet to the remote server hostname:port.
For example:

telnet 25
telnet 25

You’ll get a response back like this:

220 - Maillennium ESMTP/MULTIBOX rwcrmhc14 #51


220 ESMTP x56sm1026797pyg

You may then type "quit" followed by a carriage-return.
If there is no connectivity, your DOS command prompt will hang.

Here are other examples:

To telnet to a POP3 server:
telnet 110

You’ll get a response such as:

+OK AVG POP3 Proxy Server <> 7.5.442/7.5.446 [268.18.11/721]

Type "quit" followed by a carriage-return.

To telnet to an IMAP server:
telnet 143

the response looks something like this:
* OK v52_r1.2 server ready

type "123 LOGOUT" followed by a carriage-return.

To telnet to an FTP server:
telnet 21

the response looks like:
220 Microsoft FTP Service

type "quit" followed by a carriage-return.

To telnet to an HTTP server:
telnet 80

You’ll get a prompt back waiting for input. Type "quit" and press RETURN, and you’ll get this back:

HTTP/1.1 400 Bad Request
Content-Type: text/html
Date: Thu, 15 Mar 2007 10:30:02 GMT
Connection: close
Content-Length: 35
	<h1>Bad Request (Invalid Verb)</h1>
Connection to host lost.

What happens if you try to telnet to a SSL port? (i.e. port 465 for SMTP, port 995 for POP3, port 993 for IMAP, port 990 for FTP, port 443 for HTTP)
You’ll get a prompt back without any text. If you start typing some garbage, like "asdfasdf…" you’ll see that the server just closes the connection and you get your DOS prompt back. It’s because you obviously weren’t sending what it expected to establish an SSL connection — but you did verify TCP/IP connectivity with the remote port.

Privacy Statement. Copyright 2000-2011 Chilkat Software, Inc. All rights reserved.
Send feedback to

Components for Microsoft Windows XP, 2000, 2003 Server, Vista, Windows 7, and Windows 95/98/NT4.