Failed to get initial SMTP response..

I have 21 text message service applications running on a single PC. These apps send out weather alerts to radio station listeners several times a day. Each may have a few subscribers to a few hundred subscribers, so at the top of the hour, the messages for the people signed up for that hour are sent.
I sometimes get this error:

    DllDate: Aug 24 2008
    Username: User
    Component: ActiveX
      NumTo: 1
      To: ****
      NumCC: 0
      NumBCC: 0
    Need new SMTP connection
      Connecting to SMTP server mail.****.net:25
      smtp_host: mail.****.net
      smtp_port: 25
      smtp_user: abc@****.net
      numBytesRequested: 1000
      Connection closed by server.
      Socket is no longer readable
      Failed to get initial SMTP response..
      The SMTP server may be denying access for this domain.
    Failed to connect to SMTP server.


It’s possible that at times you have too many simultaneous connections to the SMTP server.  It may be that the SMTP server is immediately disconnecting from your program because of this condition.  Check your SMTP server configuration/settings to see if you can find anything related to the maximum number of sessions allowed.  It might also be caused by the fact that all sessions are coming from the same IP address, and the SMTP server might put a limit on this specific condition.

One possible solution is to have each instance of your application check and send email at different times.

Note: You may ignore this part of the error message:  “The SMTP server may be denying access for this domain.”  It only provides a suggestion for one possible cause of the problem.  If the SMTP server were denying access for the domain, you would either (1) never be able to establish the connection in the 1st place, or (2) every attempt to send email would fail.

SSH: Failed to read 1st key exchange packet

Here’s an explanation for the following error message:

    Established TCP/IP connection with SSH server
    FromServer: SSH-1.5-Cisco-1.25
    numBytesRequested: 8
    Connection closed by server.
    Failed to read data on SSH connection.
    Failed to read 1st key exchange packet

The error message indicates that as soon as the TCP/IP socket connection was accepted
by the SSH server, it then decided to disconnect. No data was exchanged over the socket connection. In other words, you didn’t even receive the initial “hello” message.

The SSH server probably rejected the connection based on the IP address from which you’re connecting.

WriteZipAndClose – Failed to move Zip file

When Chilkat Zip writes a .zip, it first writes to a temporary file. (The location of the temporary file is controlled by the zip.TempDir property.) After the .zip is successfully written to the temp file, it is then renamed (i.e. moved) to the output filename. The reason for doing this is to safeguard an existing .zip when rewriting. If writing the .zip fails for any reason prior to completion, then the original .zip is not lost.

A “Failed to move Zip file” error in LastErrorText indicates a failure to overwrite the existing .zip. This could occur if the existing .zip is opened by another process, or if the calling process does not have permission to overwrite the existing file.

    DllDate: Mar  1 2009
    from_filename: .\ckz_Z46J.tmp
    Failed to move Zip file

Server object error ‘ASP 0177 : 800401f3’

This error is occasionally reported by customers using classic ASP:

Server object error 'ASP 0177 : 800401f3'
Server.CreateObject Failed

The call to CreateObject in ASP looks like this:

set cryptObj = Server.CreateObject("Chilkat.Crypt2")

The problem is that IIS was unable to lookup “Chilkat.Crypt2” in the registry in order to get the location of the DLL file. There are many possible reasons that could cause this failure, and these are listed at the page linked below.

However, it is important to realize that this not a problem with the DLL. If you Google “ASP 0177 : 800401f3” you’ll find that this potential problem is common to all ActiveX components, even ActiveX’s produced by Microsoft. The Chilkat ActiveX DLL’s are standard self-registering ActiveX components. There is nothing special about any Chilkat ActiveX with respect to regsvr32 registration.

A list of possible system problems that might cause this error can be found here:

Object reference not set to an instance of an object.

Any Chilkat method that returns an object will return a NULL reference if the method failed. You should check for NULL and then examine the contents of the LastErrorText property. Here are examples in various programming languages:

//  Fetch the emails into a bundle object:
Chilkat.EmailBundle bundle = null;
bundle = imap.FetchBundle(messageSet);
if (bundle == null ) {


'  Fetch the emails into a bundle object:
Dim bundle As Chilkat.EmailBundle
bundle = imap.FetchBundle(messageSet)
If (bundle Is Nothing ) Then
    Exit Sub
End If

Visual Basic 6.0

'  Fetch the emails into a bundle object:
Dim bundle As ChilkatEmailBundle2
Set bundle = imap.FetchBundle(messageSet)
If (bundle Is Nothing ) Then
    MsgBox imap.LastErrorText
    Exit Sub
End If


//  Fetch the emails into a bundle object:
bundle := imap.FetchBundle(messageSet);
if (bundle = nil ) then

Visual FoxPro

*  Fetch the emails into a bundle object:
loBundle = loImap.FetchBundle(loMessageSet)
IF (loBundle = NULL ) THEN


    //  Fetch the emails into a bundle object:
    CkEmailBundle *bundle = 0;
    bundle = imap.FetchBundle(*messageSet);
    if (bundle == 0 ) {


    //  Fetch the emails into a bundle object:
    CkEmailBundle bundle;
    bundle = imap.FetchBundle(messageSet);
    if (bundle == null ) {


#  Fetch the emails into a bundle object:
# bundle is a CkEmailBundle
$bundle = $imap->FetchBundle($messageSet);
if ($bundle eq null ) {
    print $imap->lastErrorText() . "\n";


# bundle is a CkEmailBundle
bundle = imap.FetchBundle(messageSet)
if (bundle == None ):
    print imap.lastErrorText()


# bundle is a CkEmailBundle
bundle = imap.FetchBundle(messageSet)
if (bundle == nil )
    print imap.lastErrorText() + "\n"

SQL Server

    --  Fetch the emails into a bundle object:
    DECLARE @bundle int
    EXEC sp_OAMethod @imap, 'FetchBundle', @bundle OUT, @messageSet
    IF @bundle Is NULL 
        EXEC sp_OAGetProperty @imap, 'LastErrorText', @sTmp0 OUT
        PRINT @sTmp0


The first step in debugging a Chilkat method that returns a failed status is to examine the contents of the LastErrorText property. The LastErrorText property will contain information about the last method call on the object.

For example:

success = mailman.SendEmail(email);
textBox1.Text = mailman.LastErrorText;

The LastErrorText property is standard on all Chilkat classes/objects.  The error information may also
be accessed in XML or HTML format via the LastErrorXml and LastErrorHtml properties.
It may also be saved to a file by calling SaveLastError.

The LastErrorText will contain information about what transpired within a method call
even when the method succeeds.  Therefore, if a method returns a value indicating success,
but something did not go as expected, examine the contents of LastErrorText.

Note: The purpose of the LastErrorText is to help programmers determine the cause of a problem. It contains detailed information and is not something you would normally display to non-technical end-users.

It is designed to provide most (if not all) of the information that should be sent to when requesting support.  Please be sure to cut-and-paste the contents of the LastErrorText into your support email request.  (Please: Simply cut-and-paste the text.  This is much preferable to screen captures, MS-Word docs, or image files (JPG, GIF,  BMP) etc.)

When examining the LastErrorText, look for the “DllDate” that is contained within it.
If it is more than a few months old, Chilkat will most likely ask you to try the latest
pre-release from   This is to ensure that you
are not reporting a problem that is already fixed, and it also makes sure the LastErrorText
has the best information.  The contents of LastErrorText is continually being improved
and refined.

C++ Notes:

The LastErrorText “property” is actually accessed as one of two methods:
void LastErrorText(CkString &str),
const char *lastErrorText(void)

No socket exists for sending

If the error message “No socket exists for sending” is found in the LastErrorText, it means that the component is not connected to the server. For example, if Ftp2.PutFile is called to upload a file, but Ftp2.Connect is never called to establish the connection, the “No socket exists for sending” would be found in the LastErrorText. Another possibility is that Connect was called, but the success/failure return value was never checked to see if it actually succeeded. Or perhaps the Connect succeeded, but at some point after a method which communicates with the server failed and the connection was lost. It’s extremely important to check the success/failure return value of any method that communicates with a server.

ChilkatDotNet2.dll on x64 from a Windows Service

Here’s the secret to getting the .NET runtime to load the ChilkatDotNet2.dll from a Windows Service: It must be installed in the GAC, but there’s a separate GAC for 64-bit assemblies:

(with permission from the Chilkat customer)
I was able to find a solution to this. I'm running a 64-bit version of
Vista, and there turns out to be a separate GAC for 64-bit assemblies, and
my application was searching there, and was not able to find the 32-bit
Chilkat assembly. I installed the 64-bit version in addition to the 32-bit
one in the GAC, and then the assembly loaded fine. Why this works when
running as a normal application but not when running as a service I don't
know, but at least it is working now.

Thanks for your excellent support!

This was the original error:

(with permission from the Chilkat customer)
> > Thanks for your immediate response. I tried to install the assembly in the
> > GAC, but it does not seem to help. I am able to load another GAC assembly
> > without problems:
> >
> > Assembly a = Assembly.Load("Microsoft.Practices.EnterpriseLibrary.Logging,
> > Version=, Culture=neutral, PublicKeyToken=bf81d2044fa6b642");
> > Assembly b = Assembly.Load("ChilkatDotNet2, Version=,
> > Culture=neutral, PublicKeyToken=eb5fc1fc52ef09bd");
> >
> > The first load does not throw an exception, but the second does:
> >
> > System.IO.FileNotFoundException: Could not load file or assembly
> > 'ChilkatDotNet2, Version=, Culture=neutral,
> > PublicKeyToken=eb5fc1fc52ef09bd' or one of its dependencies. The system
> > cannot find the file specified.
> >
> > When turning on logging of the binding, it does not seem like the GAC is
> > searched at all, only the file system (current directory).
> >
> > I'm suspecting that this is a permission problem, but running the service as
> > LocalSystem or LocalService gives the same result.