Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Network program

 
Elise Daans
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello!

for school i have to make a network application in java.
i once made a java-chatbox with sockets but just sending strings is alot easyer then what this is all about.

what do i have to make?
client: everyone in the network has a small gui where he can set the right path to his dir with movies and his dit with mp3's.
When the client starts it connects to the server

server: accepts connection from client
checks whenever the client has new movie or new mp3 (so it is not already on the server)
if client has something new.. client uploads the new file to the server.

Please can anyone give me a hand with this? i don't really know how to start with it.

many thanks in advance

Elise Daans (belgium)
 
Rajiv Babu
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Looks like you are trying to develop another file swapping system. . Ok here goes. You already have experience is sending strings over a socket connection. So all you have to do is define a set of commands between the server and the client. For instance once the client connects, the server can send a command "SCAN" to the client. Once the client receives this he starts a scan on a preset directory. However, you may have to preserve the last state of the directory in some place. Say a database. So now you have 2 sets to compare. How much data you compare is left to you from filenames to size to anything else. Once the client completes a scan he can update his database. To upload files to the server automatically, the server should support something like FTP. Establish a data connection and send the files. They can be put on the server. You can make this process an independent thread so users can use other features of the client say chat.

This is one simple design. You can take help from java.net packages for sending commands. Develop the UI with swings and even pass data with DataOutputStream classes. Well thats a very broad perspective. But I guess thats all is possible over the forum. Rest is left to you to explore.

rgds,
Rajiv
 
Elise Daans
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tx for you reply.
Now i made a list of what i should do to make it work
- server waits for a connection on a certain port
- client tries to connect on server
- server acceps connection from client
- (on the client is a directory selected) de name and size of every file will be send to the server
- server checkes whenever the filename + size already is in its database (that contains all file-information on the server)
- if yes? server just goes to the next file
- if no? server ask client to upload that file (which is not on the server)
- when the whole list is done .. server cloes the connection with the client.

Now i've got the following guestion: How can I get the filenames out of the directory i selected on my client? i have to "read" a filename and send this filename to the server but i don't know how to get that information out of the dir.

Hopefully someone knows a solution to this problem

Many thanks,

Elise
 
Joe Ess
Bartender
Posts: 9280
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The java API Documentation for java.io.File may prove useful.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic