开发者

How can I get the other users' IP address on network with C#?

开发者 https://www.devze.com 2023-03-16 10:35 出处:网络
I want to get the IP address of devices which\'s are on my wireless network, 开发者_开发百科and I want to detect when someone connects to the network.

I want to get the IP address of devices which's are on my wireless network, 开发者_开发百科and I want to detect when someone connects to the network.

How can handle network connection in C#?


Since "you" are not the router (or whatever kind wireless dispatcher it is) there is no safe way for you to learn when someone connects to the network. Sure most OSes would broadcast their connection on the network and such, but it's not "mandatory" to do so. What I would suggest is to query all the possible IP addresses.

WAIT! Don't scream yet.

My guess is that you're aware of the wireless IP address range of the network, which I guess shouldn't be THAT big. If you do some kind of ping on a timer on each IP address, you won't know exactly when the client connected, but you'll know he's there. This is true only if the router don't block the pings on the LAN and if the clients accept to respond to the ping.

0

精彩评论

暂无评论...
验证码 换一张
取 消