Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Detecting hosts connected to a lan

In order to create a lan messenger in c# I need to detect the host computers online obviously using the same lan messenger software. I tried searching for a starting point to do so, but in vain. I need to know how to start the work.

like image 534
Avik Avatar asked Mar 05 '26 06:03

Avik


2 Answers

There are two ways I've done this in the past: having all the clients connect to predefined host (easy, but requires some client configuration) and having the host (or client) broadcast their existence via the the 'broadcast' address (eg, 10.0.255.255) (hard, firewalls/NATs can make life painful, clients require no configuration).

But, yes -- if WCF implements a discovery protocol, go with that. Provided it does what you want, it's probably better than anything you (or most people, for that matter) could write.

like image 163
David Wolever Avatar answered Mar 07 '26 18:03

David Wolever


Can you use Windows Connection Foundation? If so, you could use WCF to implement the WS-Discovery protocol. Here's a brief howto.

like image 27
sblom Avatar answered Mar 07 '26 19:03

sblom



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!