Hello I know how to make clients and servers using TCP/IP and so on How can I transfer file from one computer to other with Java? what is the best way to make is really quick and not read line by line and so on? Tank for the help
I'd Google for a "Java FTP" package and use the FTP APIs. It would be fun to write your own over sockets, but an existing package would represent an awful lot of problems already solved.
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Oz Kron
Ranch Hand
Joined: Feb 27, 2007
Posts: 41
posted
0
The point is that I don't want it to be FTP I just want the server to get a client full path and then download this file from his computer Like point to poing transfer
Originally posted by Oz Kron: The point is that I don't want it to be FTP
Okay. Then what protocol do you want to use instead? You can't just download a file from somebody else's computer unless that computer has a server that is running and willing to give you the file.
Oz Kron
Ranch Hand
Joined: Feb 27, 2007
Posts: 41
posted
0
Well Maybe I wasn't clear enouth Let's say my friend is running a server java program I have sent him I know it's IP and I have the client How can I download form him? Just how to make a simple server-client programs to make it possible?
Just how to make a simple server-client programs to make it possible?
Yes, it's possible, but you need to agree on a protocol on how to transfer the data. Of course you can roll your own, but that's like reinventing the wheel, because you're going to have to solve a lot of problems that have been solved by FTP and other protocols already.
The point is that I don't want something too much sophisticated or something like that Just plain and simple Can you give me an exmaple for this please?
I don't think I am getting your requirements correctly. Let me ask this: is your goal to get something useful done, or is your goal to learn about programming by writing a program?
Oz Kron
Ranch Hand
Joined: Feb 27, 2007
Posts: 41
posted
0
I want both To learn and to write a program
Stan James
(instanceof Sidekick)
Ranch Hand
Joined: Jan 29, 2003
Posts: 8791
posted
0
Cool! Then we'll switch from the most efficient mode (like I was paying you by the hour) to having some fun and getting it done.
Have you run through the Sun Networking Tutorial? It's really quite good and should get you sending data back and forth with sockets. Reading and writing that data from files is easy to add on once you have things going.
The "Knock Knock Protocol" in the tutorial is an example of a protocol, which is simply a set of rules about what you send each way. A conversation for file transfer might look like: