ask for information about bandwidth - Unix

This is a discussion on ask for information about bandwidth - Unix ; Hi, I am doing a network programming in which I need the information about the used bandwidth of my neighbor. How can I get that information? Is there any existed functions in the library? Thanks a lot! Best, Tony...

+ Reply to Thread
Results 1 to 3 of 3

Thread: ask for information about bandwidth

  1. ask for information about bandwidth

    Hi,

    I am doing a network programming in which I need the information about
    the used bandwidth of my neighbor. How can I get that information? Is
    there any existed functions in the library?

    Thanks a lot!

    Best,
    Tony

  2. Re: ask for information about bandwidth

    Tony, Zhang wrote:
    > I am doing a network programming in which I need the information about
    > the used bandwidth of my neighbor.


    You might want to be more precise about what "neighbor" means.
    I generally view a network as a bunch of hosts which can send messages
    to each other. What relationship do two hosts have that would
    determine whether they are neighbors? Do they have to be in the
    same building? Same physical network segment? Just nearby?
    It's not very well-defined.

    Also, even if you know the bandwidth that some host has used, it
    is not necessarily useful information. The path between one host
    and another usually passes through several points, and each point
    may have its own bandwidth limitations. In fact, in some cases
    the bandwidth limits may not even be constant. In a wireless
    network (such as wi-fi or GSM), the bandwidth varies unpredictably
    as a function of the signal quality and error rate at the hardware
    level. In such a situation, knowing the bandwidth used doesn't
    tell you much about the remaining bandwidth available (if that is
    what you're looking for).

    - Logan

  3. Re: ask for information about bandwidth

    Tony, Zhang wrote:

    > I am doing a network programming in which I need the information about
    > the used bandwidth of my neighbor. How can I get that information? Is
    > there any existed functions in the library?


    Your question isn't very clear. Perhaps you are asking "how much
    network traffic passes through the neighbor while my program runs?"
    If so, and on linux, you can do something like this:

    ifconfig eth0; time test_program; ifconfig eth0

    Then look at the RX and TX statistics before and after, and divide
    by the elapsed seconds for your run emitted by "time". Note that for
    this to reflect the action of your one program pretty much nothing else
    should be using the network. The same packet info can also be extracted
    from /proc/net/dev, for instance:

    grep eth0 /proc/net/dev > start.dat ; \
    time test_program ; \
    grep eth0 /proc/net/dev >end.dat

    Regards,

    David Mathog

+ Reply to Thread