Transferring Files Programmatically

Garet Jax

Diamond Member
Feb 21, 2000
6,369
0
71
Hello all,

I have an interesting problem that I need some suggestions with.

I want to be able to tranfer file(s) from a generic platform to a Sun Solaris box in an automated way using code. The reason why it is a generic platform is that we really don't know what the platform will be.

I have thought about using SOAP with attachments, but it would require me to install a webserver (or at least SOAP onto an existing webserver) and I want to minimize the amount of work behind a client's firewall.

I am using Java, but would move to any other language if it offered an easy way to solve this.

Does anyone have any ideas for me? Thanks.
 

michaelh20

Senior member
Sep 4, 2000
482
0
0
If java is what you are after, I have two things.. first I have a class that transfer files between two computers using sockets. You start up the sender with : "java ZipMover server 2222 ..file & dir list here" You start up the getter with : "java ZipMover client servername 2222" It transfers entire directories using ZipStreams over sockets (this entails certain limits also) :) Have to be aware that on the receiving end it puts all directories under the current dir to prevent wayward writing from the other side.

ZipMover

Beside that I have entire java ftp client / server on my website.

my ugly website

It's all a bit at your own risk if you use my code (test thoroughly), but the ideas for file transfer are there. Basically open up a socket on one end, connect to that socket from the other computer, transfer everything over for a given file, close socket and repeat for each file -- maintaining another socket for command control (saying -- I'm about to open a socket at such and such a port -- please connect there -- woops didn't work etc..) (this is what FTP does). My ZipMover class opens up a socket and basically sends a zip file over the socket so it doesn't have to keep reconnecting all the time.

I'm sure the thought of this will have network security gurus jumping up and down by now... sftp is a different beast but more secure.
 

Garet Jax

Diamond Member
Feb 21, 2000
6,369
0
71
michaelh20,

Thanks for the response. Moving files over sockets is a good idea, but it requires punching a hole in the client firewall that didn't exist before or redirecting all traffic from an existing hole to the new server or complex firewall rules that move certain traffic to the new server while keeping all other traffic directed to the old server.

Unfortunately this is out because government network staff do not like touching their firewalls for outside company's software.

I have worked through an idea that does exactly what you did with an FTP client, but I have extended it a little bit. I am also including SFTP and SCP. The problem here is that many clients do not run FTP servers because of the security risk and do not have the interest to run SFTP or SSH servers.

I am starting to believe that there is no perfect solution.