|
Server socket - send image to client
Hey,
Im new to JAVA so go easy on em please.
I have a server and a client that can successfully connect to each other and other stuff but 1 function of the server is to send an image to the client. I can send the image but i was wondering how i would obtain certain information about the transfer. How would i obtain information such as:
Time taken to transfer image
average bit rate
// Server code
FileInputStream fis = new FileInputStream("images\\picture.jpg");
byte[] buffer = new byte[fis.available()];
fis.read(buffer);
ObjectOutputStream oos = new ObjectOutputStream(serverSocket.getOutputStream()) ;
oos.writeObject(buffer);
// Client code
ObjectInputStream ois = new ObjectInputStream(clientSocket.getInputStream());
byte[] buffer = (byte[])ois.readObject();
FileOutputStream fos = new FileOutputStream("downloaded\\picture.jpg");
fos.write(buffer);
if you need anything else explain or more info please let me know.
|