Results 1 to 12 of 12

Thread: Possible to monitor downloads with .NET?

  1. #1

    Thread Starter
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428

    Possible to monitor downloads with .NET?

    is it possible to monitor the amount of download/upload of the network with .NET classes? how about with windows APIs? anyone knows how I can do this?
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

  2. #2
    Fanatic Member
    Join Date
    Sep 2002
    Posts
    518
    You could look into performance counters, maybe there is a way to get performance counters by process (your .NET app). I'm on the way out the door or I'd look into it also...

  3. #3
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    There is definately a way, I just haven't found it yet... Are you talking like when you double click the little network icon down in the system tray it shows the outgoing and incomming totals?

  4. #4

    Thread Starter
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428
    Originally posted by hellswraith
    There is definately a way, I just haven't found it yet... Are you talking like when you double click the little network icon down in the system tray it shows the outgoing and incomming totals?
    yeah exactly but stupid windows doesnt usually tell you the amount transferred in bytes. Its unit is in BLOCKS on my comp.... I'll take a look at the performance counter
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

  5. #5
    Fanatic Member
    Join Date
    Sep 2002
    Posts
    518
    This looks like what you want:

    ms-help://MS.VSCC/MS.MSDNVS/cpgenref/html/gngrfnetworkingperformancecounters.htm

    tracks bytes rec'd/sent.

  6. #6

    Thread Starter
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428
    Originally posted by Slow_Learner
    This looks like what you want:

    ms-help://MS.VSCC/MS.MSDNVS/cpgenref/html/gngrfnetworkingperformancecounters.htm

    tracks bytes rec'd/sent.
    aah thanks alot I'll have to do a little research before I can use it though I have no clue how to use a performanceCounter
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

  7. #7

    Thread Starter
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428
    umm one thought: I have to specify an instance name for the performance counter. I'm currently choosing this in design time. The instance name is my network card. The problem with this is that some other machine would have a different network card. I don't think this would work on another machine then

    The category that I chose is Networking Interface, with the "Bytes Sent/sec" counter. There are these three instances to choose from:
    -Linksys LNE100TX Fast Ethernet Adapter[LNE100TX v4] - Packet Scheduler Miniport
    -MS TCP Loopback interface
    -Microsoft TV_Video Connection

    the first one if my network card. Would the second chose appear on every PC? or would I have to prompt the user with a list of available "instances" and ask the user to choose the correct one?
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

  8. #8
    Fanatic Member
    Join Date
    Sep 2002
    Posts
    518
    You could do what other network monitor programs I've used do: enumerate all installed interfaces, and total ALL of their network traffic, or allow the user to select one.

  9. #9

    Thread Starter
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428
    Originally posted by Slow_Learner
    You could do what other network monitor programs I've used do: enumerate all installed interfaces, and total ALL of their network traffic, or allow the user to select one.
    HMM, I wanna monitor upload/download, so that means I'll have to make 6 performance counters
    I dont understand. isnt all the network traffice supposed to go through the network card? what are the other two that are listed there?
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

  10. #10
    Fanatic Member
    Join Date
    Sep 2002
    Posts
    518
    Those are other "network adapter" drivers that are also installed. The Loopback Adapter is a software-only set of hooks that is usually installed in the absence of a hardware network adapter, in order to allow you to install networking components and have them still work (it's installed on mine for example so I can run MSDE while not dialed up, because I only have a modem).

    The other one I don't know, it may be part of Windows XP's networking components.

    Here are the walkthroughs for performance counters:

    ms-help://MS.VSCC/MS.MSDNVS/vbcon/html/vboriperformancecounterwalkthroughs.htm

    These show retrieving and displaying performance counters programatically, at runtime, instead of using the the dragdrop component.

    Duh, I also attached a very generic drag/drop performance counter demo from the Sam's VB.NET in 21 days book.
    Attached Files Attached Files
    Last edited by Slow_Learner; May 26th, 2003 at 02:56 PM.

  11. #11

    Thread Starter
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428
    thanks for your help Slow_Learner. That MSDN article tells me how to receive the categories and the counter names, but I have no idea how to receive a list of instances. Is it even possible? there seems to be no way to do this any ideas?
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

  12. #12
    Addicted Member javad2000's Avatar
    Join Date
    Dec 2006
    Posts
    238

    Re: Possible to monitor downloads with .NET?

    ms-help://MS.VSCC/MS.MSDNVS/vbcon/html/vboriperformancecounterwalkthroughs.htm
    The link doesn't work. Can someone plz give me the correct link, or at least a brief guide on how to monitor the daily internet traffic on my PC? (vb 2005)

    Thank you

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width