WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

WinInet
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

FTP Keep Alive


Question:

I am using the WWINT34i.DLL to connect to a FTP site, but the connection keeps timing out at a certain spot. The host admins are telling me that they need keep alive packets sent on that connection to let them know I'm alive!

As annoying as this is, I'm trying to figure out a way to have two FTP connections to the same host: 1) transferring the data, 2) doing different commands back to the host to let it know I'm still downloading.

We tried a freeware FTP client that has this ability and the connection stays open. I can see two connections to the host port 21. If it comes down to it, I may just have to figure out a winbatch way to send commands through that freeware ftp client.

Answer:

The need to enable keep-alive packets is required when you are transferring a large file via FTP (usually over a slow link) and a firewall in between is configured to kill what is perceived as a 'dead' connection.

In simple terms what is happening is that once the file transfer has begun, there's nothing being passed through the Control Channel. To a firewall in between it sees the Control Channel doesn't detect anything being passed through it. It then intreprets the Control Channel as a 'dead' connection and closes it.

Unfortunately for the file being transferred, if the Control Channel is closed before the transfer is complete it results with a failed transfer.

There are two options available.

A. In the Windows o/s there is a registry setting that will enable a keep-alive packet to be sent once every two minutes. This will effectively keep the connection alive and therefore open preventing the time-out.

For the registry key that will need to be modified search of MS's Knowledgebase for the term 'keep-alive' and 'TCP'. The last I looked there were two different technotes. One for Windows 95/98 and one for Windows NT,2000, etc.

B. Within FTP you can use the NOOP command over the Command Channel once every minute or so and that will keep the Control Channel alive until the transfer is complete.

NOTE:
The WinInet Extender function iFtpGet and iFtpPut have been updated to support the 'Keep Alive' functionality.


Rev 44075 April 11th, 2005
   Added optional parameter to iFtpGet and iFtpPut to keep alive the connection.

   Removed 32k total string length limitation and removed 8k value limitation from iContentUrl.

   The WinInet extender has been updated to a new
   format to allow more descriptive function names and
   additional parameters.  This version of the extender
   requires	WinBatch 2004B or newer to run.  This
   extender will not work on WinBatch 2004A or older.
   
   In addition, so as not to affect existing scripts using
   a previous version of this extender, the extender DLL
   has been renamed to include a 44I in the DLL name
   instead of a 34I.  Old and new versions of this
   extender can *usually* co-exist side by side.
   
   To use the new extender with old scripts and with
   WinBatch 2004B or newer you will need to change the
   AddExtender line in the script to reflect the new DLL
   name.   e.g.
   
      AddExtender("wwint34i.dll")
   should become
      AddExtender("wwint44i.dll")


Article ID:   W16883
File Created: 2007:07:03:14:26:42
Last Updated: 2007:07:03:14:26:42