measure bandwidth in / out of socket

Discussion in 'Java' started by antoine, Sep 30, 2005.

  1. antoine

    antoine Guest

    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.
    antoine, Sep 30, 2005
    #1
    1. Advertising

  2. antoine

    Roedy Green Guest

    On 29 Sep 2005 19:12:29 -0700, "antoine" <>
    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.
    Roedy Green, Sep 30, 2005
    #2
    1. Advertising

  3. 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.
    >
    Abhijat Vatsyayan, Oct 1, 2005
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Sven
    Replies:
    2
    Views:
    9,165
    Peter Schmidt
    Nov 7, 2005
  2. Max
    Replies:
    5
    Views:
    1,319
    Esmond Pitt
    Feb 29, 2004
  3. deep
    Replies:
    1
    Views:
    6,870
    Roedy Green
    Apr 9, 2006
  4. Andrew Hayes
    Replies:
    4
    Views:
    1,644
    kiran
    Feb 16, 2010
  5. Ste

    Measure socket connection time

    Ste, Mar 20, 2006, in forum: Perl Misc
    Replies:
    2
    Views:
    219
    DJ Stunks
    Mar 20, 2006
Loading...

Share This Page