Win a copy of Transfer Learning for Natural Language Processing (MEAP) this week in the Artificial Intelligence and Machine Learning forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Tim Cooke
  • Paul Clapham
  • Devaka Cooray
  • Bear Bibeault
  • Junilu Lacar
  • Knute Snortum
  • Liutauras Vilda
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Piet Souris
  • salvin francis
  • Carey Brown
  • Frits Walraven

Network program

Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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)
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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 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.

Elise Daans
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,

Posts: 9612
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The java API Documentation for may prove useful.
She said she got a brazillian. I think owning people is wrong. That is how I learned ... tiny ad:
Two software engineers solve most of the world's problems in one K&R sized book
    Bookmark Topic Watch Topic
  • New Topic