开发者

Get all possible servers on a LAN network

开发者 https://www.devze.com 2023-03-31 17:03 出处:网络
I\'m using the details on connecting to a server from a client here:http://www.egghead开发者_C百科cafe.com/articles/20020323.asp

I'm using the details on connecting to a server from a client here: http://www.egghead开发者_C百科cafe.com/articles/20020323.asp

It's quite out dated but I just need it for a quick project. I need the client to auto-connect. This program will be running on the LAN only, is there a way to find on what computer the server is running on (i.e. all computers hosting the specific server on port x). I've seen it on a couple of games that run on LAN. Without access to the internet, they manage to display all available games on the local LAN. I'm doing this with VB.net.

Thanks!


IF you make all your clients/servers listen on a specific UDP port you can just multicast on that UDP port and get an answer from the server(s)... OR the server just muticasts on that port in a spcific interval (i.e. once every minute/10 sec...)... this way you know the server and if need be all clients on the LAN... a UDP multicast doesn't leave the LAN since the usual routers/firewalls would need to be explicitly configured to allow UDP multicast packet to leave the LAN...

some reference links including VB.NET source code:

  • http://msdn.microsoft.com/en-us/library/system.net.sockets.udpclient.aspx
  • http://www.dotnet247.com/247reference/a.aspx?u=http://www.knowdotnet.com/articles/udpbroadcastmessage.html
  • http://www.eggheadcafe.com/articles/20040126.asp
0

精彩评论

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

关注公众号