Click here to Skip to main content
15,888,908 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi all,

Apologies, I am not a regular programmer so go gentle.

I have written a C# program to simply measure TCP round trip times to any device and I have written it as a simple Console application. It works fine and whilst not particularly clever does what I need it to do and removes ICMP firewall issues.

So, I would like to take this a little further. Rather than testing against a single device each time, I would like to measure multiple devices at a time, potentially up to 500 devices and to do this I intend to keep it simple by listing in a file the devices to poll - again nothing particularly challenging and simple. However, I am struggling to understand the best way to manage 500 connection in one go, indeed is this possible in C#? I am guessing that I need to establish a thread per connection?

Finally, because the program is not very exciting - I would like to understand how I could present the devices as an icon or image on a web-page or Windows form. The idea being that an icon (hope that's the right terminology) identifies the device name or IP and effectively running the program thread highlighting the measurement. Anybody know of resources that might highlight something akin to what I am hoping to do here - as I am keen to learn.

Many thanks in advance for your time and advise.

hippo
Posted
Comments
db7uk 3-Jan-14 15:51pm    
Hiya,

What sort of UI are you thinking on using? web, wpf, console?

One way I would do this is by creating a method that does the chatter (poll or ping etc).
You could then create a list of poll objects and run a Parrallel.foreach() on it to maximise the requests. Either that or use a loop and request using Tasks (TPL). In each case you should think about throttling and locking if writing to a file.

A very nice way of doing it would be to create a WCF service that does the work. You can then handle multiple concurrent requests to this service and handle throttling there however I am unsure of the scope of your requirement.

In any case, because TCP round trips (pings etc) are very fast, the 500 requests should be very possible using Tasks or Parallel loops. That's my understanding anyway.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900