aspose file tools
The moose likes Beginning Java and the fly likes copying files over a network Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "copying files over a network" Watch "copying files over a network" New topic
Author

copying files over a network

J Mangual
Greenhorn

Joined: Nov 15, 2008
Posts: 16
how do i copy files over a network using a socket? I have something written but I hard-code the file size.
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 16687
    
  19

J Mangual wrote:how do i copy files over a network using a socket? I have something written but I hard-code the file size.


Well, you will need to design a protocol between the two sides -- maybe the sender can send the filename and filesize, prior to sending the bytes of the file.

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
J Mangual
Greenhorn

Joined: Nov 15, 2008
Posts: 16
Here is some sample code I found while searching. Is there a way to transfer files which does not depend on the file size?

The Server:

The Client:
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: copying files over a network
 
Similar Threads
how to get list of files of another machine over a network
java network apis
Sending 1GB files over the network
Read and Write Files on a Network
CRC in java