[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: FTP Connection Sharing



Sender: Scott Klement <klemscot@xxxxxxxxxxxx>


Hi Coby,

>    Is there any way to have one program open an FTP Connection and
> have multiple programs share the connection?

Yes, but all of those programs need to share a single copy of FTPAPI in a
single job.

> Right now am using FTPAPI to open a connection with a server. But as the
> program grows in use the overhead is getting to high to keep opening and
> closing the FTP connection to the server at every call of the program.
> Each call of the program is moving different types of data to the server
> and happens randomly when other processes end. I guess what I am asking
> is if there is a way for a program to open the connection and other
> programs gain access to that FTP session to move the data? It?s also an
> AS400 to and an AS400 Connection.

I would suggest that you write a never-ending-program that sits in batch
and waits for commands on a data queue, then carries them out using a
single FTP connection.

Each time that it receives a command, it does the following:

   1) Check to see if it's still connected to the server, and if not,
        call FTP_Quit() and FTP_Conn().
   2) Carry out the request that it received on the data queue.
   3) Return success or failure back to the requesting program.

All of the programs that need to send/receive files merely have to write
an appropriate entry to the data queue.

Since it's a never ending program, it can remain connected until the
server or a network error disconnects it.  Since it's a single program
handling file transfers for many other programs, you don't have to worry
about sharing the FTP connection somehow.

-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubsribe from the list send mail
to majordomo@xxxxxxxxxxxxx with the body: unsubscribe ftpapi mymailaddr
-----------------------------------------------------------------------