Transfer files over network

T

tanis

I'm trying to figure out the best way to set it up so that files can
transfer back and forth over my network.

Two issues have me confused:

1) If I use sockets, how can I coordinate 'x' amounts of
transfers all happening on one port... if that's even possible.

2) Dealing with permissions and file ownership... is there
simply a Java IO library I should just be using to handle this?
Or this not considered "cross-platform" and I'm kinda on
my own?
 
R

Roedy Green

1) If I use sockets, how can I coordinate 'x' amounts of
transfers all happening on one port... if that's even possible.

You create a method that transfers a file. When it completes you
transfer another.

See the FileTransfer class.
http://mindprod.com/products.html#FILETRANSFER

If both ends know before you start how long the file is, they both
know the instant they are done. You don't need some magic EOF marker
that can't incidentally appear in the stream.
 
R

Roedy Green

Dealing with permissions and file ownership... is there
simply a Java IO library I should just be using to handle this?
Or this not considered "cross-platform" and I'm kinda on
my own?

Java closes it eyes and just assumes you have permission to touch the
files you go after. If you don't, you get exceptions. There is no way
to play with ownership or attributes other than read-only. That is
all quite platform specific. You need JNI.

See http://mindprod.com/jgloss/jni.html
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top