my dog learned polymorphism*
The moose likes Sockets and Internet Protocols and the fly likes Chat Client and file transfer Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "Chat Client and file transfer" Watch "Chat Client and file transfer" New topic

Chat Client and file transfer

Soumyadeep Ganguly

Joined: Mar 01, 2010
Posts: 7
I am studying HFJ now and i have some questions.
On page 519and 520 there are two programs on SimpleChatClient and VerySimpleChatServer. My question is chat-client and file transfer programs are different, right?bt the same concept of server client are used? and can i transfer file without ftp or http?

Rob Spoor

Joined: Oct 27, 2005
Posts: 19656

Soumyadeep Ganguly wrote:My question is chat-client and file transfer programs are different, right?

I don't know these two classes, but my guess is the only difference is in the actual data that is sent between the two. Unless you're talking about peer-to-peer file transfers, there's also a client-server model there.

and can i transfer file without ftp or http?

Sure. All you need to do is transfer the data from one machine to another. FTP and HTTP are only two protocols for that. Windows file sharing (a.k.a. SMB) is another protocol that can be used for this, as is NFS (for Linux / Unix). Implementing your own using direct Socket / ServerSocket pairs is also possible.

How To Ask Questions How To Answer Questions
joe vasher
Ranch Hand

Joined: Nov 06, 2009
Posts: 37
In the above, can you just use outputObjectStream and send the jar file as an object. Of course put in a bufferedstream read and write, correct?
Paul Clapham

Joined: Oct 14, 2005
Posts: 18541

No. An ObjectOutputStream is meant for sending Java objects, not files.
I agree. Here's the link:
subject: Chat Client and file transfer
Similar Threads
A general question
Compilation Error
Data from server is not sent to client
Swing vs. Applets....huh