Two Laptop Bag*
The moose likes Java in General and the fly likes copying files over the internet with sockets Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "copying files over the internet with sockets" Watch "copying files over the internet with sockets" New topic
Author

copying files over the internet with sockets

J Mangual
Greenhorn

Joined: Nov 15, 2008
Posts: 16
I need to write a program (client and server side) which takes a file name and sense the file via a socket connection to another address. For example, I might want to send a pdf file across a network. A google search gave quickly gave me a way of copying methods from one location to another on my own computer simply using InputStream and OutputStream. When trying to send files over the Net i quickly confused myself with all the different kinds of streams. Is it possible to write everything with output stream?
K. Tsang
Bartender

Joined: Sep 13, 2007
Posts: 2380
    
    7

Is it possible to write everything with output stream?


I don't see why not. Serializing objects is what most people use to transfer data or files over the network using sockets. The problem may become the network cuts off during the transfer or the client can't get the whole file. So splitting the file into chunks of bytes is more appropriate.


K. Tsang JavaRanch SCJP5 SCJD/OCM-JD OCPJP7 OCPWCD5
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: copying files over the internet with sockets