Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 11-30-2007, 09:15 PM
Member
 
Join Date: Nov 2007
Posts: 1
Hinty is on a distinguished road
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.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
send file via client - server model spasavvas Networking 5 05-29-2008 10:37 PM
send/read int in a client/server app dim_ath New To Java 2 01-03-2008 02:03 PM
how to send .jar files client to server gobinathm Networking 1 12-25-2007 05:05 AM
Identify Client in Socket Client Server Application masadjie Networking 1 12-20-2007 10:18 AM
send files through socket bbq Advanced Java 1 06-05-2007 03:08 AM


All times are GMT +3. The time now is 11:15 AM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org