Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > measure bandwidth in / out of socket

Reply
Thread Tools

measure bandwidth in / out of socket

 
 
antoine
Guest
Posts: n/a
 
      09-30-2005
Hello,

I'm currently developping a client / server application, with client &
server running on the same PC for the moment.

the goal is to ultimately run them over a WAN, and in order to improve
performances & bandwidth usage, I'd like to develop a tool that
measures the bandwidth used between client & server during the life of
the application (average & max), some kind of application-specific MRTG
(the "text" part would be enough, I can take care of the graphing
myself).

I was thinking of simply "counting" bytes written / read on the sockets
during a specific interval and log everything to a file, but I'm
wandering if there's a smarter way to do that...

does anybody know of a tool / method in the basic Java API that could
help me achieve that ? or any other tool for that matter...

thanks for your feedback.

 
Reply With Quote
 
 
 
 
Roedy Green
Guest
Posts: n/a
 
      09-30-2005
On 29 Sep 2005 19:12:29 -0700, "antoine" <(E-Mail Removed)>
wrote or quoted :

>does anybody know of a tool / method in the basic Java API that could
>help me achieve that ? or any other tool for that matter...


On Win2K you can persuade a TCP/IP icon to sit in the right end of
your task bar. IF you pop it up it tells you packets sent and received
and speed.

There is a speed tool in http://mindprod.com/jgloss/tweakdun.html

There are various tools for measuring your connection speed -- not app
speed, linked to from
http://mindprod.com/jgloss/transmissionspeed.html

If your app is bursty, you are not really interested in what happens
in idle bits.
--
Canadian Mind Products, Roedy Green.
http://mindprod.com Again taking new Java programming contracts.
 
Reply With Quote
 
 
 
 
Abhijat Vatsyayan
Guest
Posts: n/a
 
      10-01-2005
Are you using Sockets directly or are you using RMI (or something else)
for client-server communication ?

Can you not use some socks proxy implementation that will keep track of
the number of bytes written/read ?

Ideally I expected sun to have made it easier to write SocketImpl
classes but they have made class "PlainSocketImpl" package protected
leaving you with only two choices - [1] Make your class part of
"java.net" package and inherit from PlainSocketImpl (sun does not like
this) or [2] Implement all abstract methods in SocketImpl class (which
would not make sense for the kind of things you need).

If you can write your own SocketImpl class then you can create
ByteCountingInputStream and ByteCountingOutputStream and return these
implementations when asked for the streams. These implementations could
use the underlying socket for all communication and additionally keep
count of bytes. You will still have to design and implement the
mechanism for storing, tracking and accessing the data.

Abhijat



antoine wrote:
> Hello,
>
> I'm currently developping a client / server application, with client &
> server running on the same PC for the moment.
>
> the goal is to ultimately run them over a WAN, and in order to improve
> performances & bandwidth usage, I'd like to develop a tool that
> measures the bandwidth used between client & server during the life of
> the application (average & max), some kind of application-specific MRTG
> (the "text" part would be enough, I can take care of the graphing
> myself).
>
> I was thinking of simply "counting" bytes written / read on the sockets
> during a specific interval and log everything to a file, but I'm
> wandering if there's a smarter way to do that...
>
> does anybody know of a tool / method in the basic Java API that could
> help me achieve that ? or any other tool for that matter...
>
> thanks for your feedback.
>

 
Reply With Quote
 
 
 
Reply

Thread Tools

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

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
ASP.NET Page Source For Clients To Measure Bandwidth Andrew Hayes ASP .Net 4 02-16-2010 04:30 AM
Bandwidth measure using java deep Java 1 04-09-2006 09:51 PM
Measure socket connection time Ste Perl Misc 2 03-20-2006 04:44 PM
Measure Bandwidth Usage Per Web Site Sven ASP .Net 2 11-07-2005 02:48 PM
Tools to measure the effective bandwidth Chris Cisco 2 12-03-2003 12:35 PM



Advertisments