FTP timeout encountered when sending files to BC


I am using a command prompt to ftp an XML file to a folder in BC which it will then process and sends to SAP. The size of the file I am sending is only 2KB. The problem occurs occassionally when I am sending the file. The length of time it takes BC and SAP to process the file takes a long time (usually around 40 seconds or more) and disconnects the ftp connection (Error is “Connection closed by remote host.”). However, when I check BC, it registered that the service was able to process the XML and successfully sends it to SAP. Likewise in SAP, it was able to receive and process the IDOC sent by BC. This causes a problem because the system sending the file through FTP interprets the disconnection as an error and sends the file for a second time, which we don’t want to happen because it was already successfully received and processed by SAP.

I encounter the problem in both version 4.0.1 and 4.6. Our BC is housed in an NT PC.

The following is the ftp command I used in the command prompt:
ftp>open <host> <port>
I will be prompted for the username and password, then I will get the following message:
230 User <username> logged in.
ftp>cd <path>
ftp>put <xml> <- at this point, sometimes it process fast but other times, the error mentioned above occurs here

I am assuming that the cause is that SAP is executing so much tasks that it takes a longer time to response back to BC and BC to the sending system. Does anybody know how to solve this problem? If this is merely increasing the ftp timeout, can you please detailed the step by step process on how to do it.

Thanks so much in advance.