1

I need to move few files in a directory to another directroy in another machine. The source and destination directory names are known in advance. These directories will be in different Operating System(i.e. the source can be Linux and Destination can be in Windows).

To solve this, i wrote a Socket program in Java that successfully copies files from source directory to a destination directory(Tested in Windows OS). But this application needs program running in both the host and remote machine. So, my question is :

1) Is there any way to transfer files(in the ways described above) using Java Socket program without having a program running in the remote machine?

2) Whether file transfer using Java socket program, bypass firewal. In other words, if a firewall is present in the remote machine will that stop the transfer process?

3) Any alternative approach to transfer files(in the ways described above) using Java where only the host or remote need to run.?

Thanks in advance, nks

1 Answer 1

1

1) You always need a program running on both machines. However, a way to get around this problem is to use a program already running on one of these machines.

e.g. If you make the directory a Windows share (assuming this is already running) you can mount this share on the Linux box (using smbfs), you can then copy files using cp This means you don't need Java on either end, but you need A program and A service (but it can be an existing one)

2) There isn't a way to by-pass a firewall unless your network is seriously mis-configured. This is the whole point of having one.

3) Once you mount either the Windows box on Linux, or the Linux files (using Samba) on Windows youc an copy files easily, even using Java. ;)

Sign up to request clarification or add additional context in comments.

2 Comments

thanks Peter for your reply. i dont think the client will agree on the mount solution you suggested. i was trying ftp file transfer using java. i read somewhere, that this approach only needs to have ftp started on the remote machine and every machine will have an inbuilt ftp. I wrote a code to do this, but due to insufficient privilage in my machine i couldn't succeed in this.
You have to find a service, like sshd which is available from the remote machine.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.