且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何使服务器可被LAN客户端发现

更新时间:2022-06-20 22:33:11

您可以尝试UDP广播.您可以例如从客户端发送广播.然后,服务器应广播带有其地址的响应,以便客户端可以使用常规连接.

You could try a UDP broadcast. You can e.g. send a broadcast from the client. The server should then broadcast a response with its address so the client can use a regular connection.

请参见此处获取一些示例代码: http://wiki.python.org/moin/UdpCommunication

See here for some example code: http://wiki.python.org/moin/UdpCommunication