简体   繁体   中英

query on file transfer using java socket programming

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 (ie 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) 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.

eg 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. ;)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM