首页 文章

使用LuaSocket通过LAN发送UDP数据包

提问于
浏览
1

我的局域网包括一个BT“Smart Hub”路由器,一台通过以太网连接到路由器的台式计算机和一台通过wifi连接到路由器的笔记本电脑 .

我试图使用名为“lua socket”的lua库,以便在两台计算机之间发送udp数据包 .

我已经从here复制了一些非常通用的服务器和客户端脚本,以查看数据包是否实际到达 .

我的桌面配置为在LAN中具有静态专用IP地址,如果我使用随机端口和桌面的专用IP运行服务器脚本和客户端脚本,则服务器会成功收到消息 .

我希望我可以在笔记本电脑上启动客户端脚本并定位相同的IP和相同的端口,并且udp数据包将显示在桌面上,但这似乎不起作用 .

我对此有很多疑问,因为我对网络的了解不足:

Could it be that the windows firewalls of either computer or the firewall of the router are interfering with the packets?

Do I need to be sending the packets from the laptop to the default gateway and use portforwarding so they can reach the desktop?

Is the fact that the laptop is connected via wifi rather than ethernet causing a problem?

Are there more issues that I am not currently aware of?

感谢您给我的任何建议(或指向更多信息的指示) .

1 回答

  • 2

    事实证明,我桌面上的Windows防火墙被配置为阻止来自我运行的lua可执行文件的任何实例的所有传入数据,以执行我的LuaSocket脚本 .

    我在我的笔记本电脑上运行其中一个以执行客户端脚本 .

    这解释了为什么来自服务器的响应(当托管在笔记本电脑上时)通过:因为它们在技术上来自服务器而不是来自可执行文件,因此通过防火墙 .

    一旦我允许这些连接,服务器就会正确地收到指向其端口的所有数据包 .

相关问题