Thread: bandwidth

  1. #1
    eat my shorts!
    Join Date
    Apr 2002
    Posts
    294

    bandwidth

    Hi,

    I am thinking of desgning my first network program that would calculate bandwidth usage for hosts. Basically i think i should do this:

    Code:
    monitor incommig and outgoing packets.
    see where does the packet point to (ie: mydomain1.com or mydomain2.com).
    store the packet size.
    sum up the size of the packets to calculate total bandwidth used during that session and log it.
    Since I have never worked with networking, I have no idea what headers or functions i would use. Guide me to the right direction please (even if it is google)

    thanks.
    Games Reviews Previews Desktop Themes Downloads Paintball Forums Shareware Freeware and much more

    The best in Technology and Gaming News

    www.back2games.com

  2. #2
    Registered User
    Join Date
    Sep 2004
    Location
    California
    Posts
    3,268
    If you have never worked with networking, then you have a long ways to go before you do something like monitoring all packets. Doing this from scratch without using a third party library is beyond even a lot of advanced programmers.

    Start with something simple like a chat application, or a file transfer program. Then you can work your way up to something like an irc or ftp client.

  3. #3
    eat my shorts!
    Join Date
    Apr 2002
    Posts
    294
    i was going to use third parties libararies. But i do not know which headers and functions would be required to accomplish this program.
    (and i think it would be easier to monitor bandwidth than making live chat or ftp)
    Last edited by dayknight; 02-13-2005 at 06:10 PM.
    Games Reviews Previews Desktop Themes Downloads Paintball Forums Shareware Freeware and much more

    The best in Technology and Gaming News

    www.back2games.com

  4. #4
    Registered User
    Join Date
    Sep 2004
    Location
    California
    Posts
    3,268
    and i think it would be easier to monitor bandwidth than making live chat or ftp
    I'm sorry, but you're wrong. Writing a chat client requires just the basic knowledge of network programming. Packet monitoring requires a lot more.

    Anyways, the best third party library for packet capture is libpcap. It's not that hard to use, you can start monitoring packets with just a few functions calls. Parsing packet data requires knowledge of how IP packets are composed. The two main packets you will be looking at are TCP and UDP.

  5. #5
    I am me, who else?
    Join Date
    Oct 2002
    Posts
    250
    bithub is totally correct here, chat clients are miles easier than creating a packet monitor. With a chat client you need only look at the data and check for errors, while with packet monitoring you need to know much more about the packet and how everything works. definately check out libpcap, I know I tried it once without libpcap and it was confusing and I finally dropped the project. I am no expert for sure, but trying to learn things is always a good thing. Just don't make things too hard on yourself or more than likely you will give up before you ever learn.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. limiting the bandwidth of computers on my network
    By Xterria in forum A Brief History of Cprogramming.com
    Replies: 14
    Last Post: 07-14-2004, 05:58 PM
  2. getting upload and download bandwidth
    By hanhao in forum C++ Programming
    Replies: 19
    Last Post: 03-19-2004, 11:19 AM
  3. Switching frequency and Bandwidth???
    By pastecopy in forum Tech Board
    Replies: 0
    Last Post: 03-23-2003, 11:13 AM