Java Network performance analyser program help
Hi I'm quite comfortable programming java basics but have never looked at the networks side of it before.
I have been asked to create a simple program which sends a file to a computer accross the network and measure how long it takes to send and recieve.
I'm confused where to begin on this one.
Any hints or tips would be fantastic
Re: Java Network performance analyser program help
Look into the two classes ServerSocket and Socket. ServerSocket allows you to create a server that listens for a port, Socket allows you to connect to it. Also, read about DataInputStream and DataOutputStream. They make this kind of things a lot easier.
When you send over the file, just regard it as bytes. Read a number of bytes from the file, send them to the client or server (depending on who recieves the file), read more bytes, send them, and so on. This is also why I mentioned DataInputStream. It has a method called "readFully". Use it when you read the bytes from the file and when you read them from the network. It handles a few things automatically that can be tricky otherwise.
EDIT:
A simple tutorial on servers and clients and so.
http://download.oracle.com/javase/tu...ets/index.html
Documentation of the classes I mentioned.
http://download.oracle.com/javase/6/...verSocket.html
http://download.oracle.com/javase/6/...et/Socket.html
http://download.oracle.com/javase/6/...putStream.html
http://download.oracle.com/javase/6/...putStream.html
Re: Java Network performance analyser program help
That is great thank you very much, going to look into it now and give it a go, will let you know how it goes.
Re: Java Network performance analyser program help
No problems. Good luck :).
Re: Java Network performance analyser program help
Does anyone know of any programs which exist similar to this?