1
votes

My LAN consists of a BT "Smart Hub" router, a desktop computer connected via ethernet to the router and a laptop connected via wifi to the router.

I am attempting to use a lua library called "lua socket" in order to send udp packets between the two computers.

I have copied some very generic server and client scripts from here in order to see whether or not packets are actually arriving.

My desktop is configured to have a static private IP address within the LAN and if I run both the server script and the client script using a random port and the desktop's private IP, the server successfully recieves the messages.

I was hoping that I could fire up the client script on the laptop and target the same IP and the same port and the udp packet would show up on the desktop but this doesn't seem to work.

I have many questions about this as my knowledge of networking is lacking:

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?

Thanks for any advice (or pointers to further information) that you can give me.

1
I noticed udp:setpeername("127.0.0.1", 53474) in the example code. You're not using 127.0.0.1 on either the client or the server, correct? Don't. 127.0.0.1 on the server side will exclude receiving traffic from any other machine, and on the client side it means sending to yourself, of course. Did you try doing this the opposite direction, reversing client and server between the two machines? Did you turn off the windows firewall? Can the two machines ping each other? Have you tried Wireshark?Michael - sqlbot
Correct, 127.0.0.1 is localhost so I replaced this on the client side script with 192.168.1.71 which is the static IP for my desktop which will be running the server script. The server script itself seems to respond to any packets sent to it so it doesn't need to specify any IP address destination. I will try the opposite direction and I will look into pinging and Wireshark, thank you for the suggestions.James
I have been successful in recieving packets when hosting the server on my laptop however I am unable to replicate this when I host the server on my desktop. I assume this is due to some differences in windows configuration settings.James
That's a reasonable assumption. Are you able to ping both ways?Michael - sqlbot
UDP protocol doesn't have any way of tracing packets ... I'm not sure where you got that idea, because that's not an accurate statement at all. UDP doesn't have connections, so each packet has no context relative to any other packet ... but you can capture them and see them and read their headers and payload with your eyeballs, confirming whether they are arriving at the destination. Wireshark is pretty much an indispensible tool.Michael - sqlbot

1 Answers

2
votes

As it turns out, the windows firewall on my desktop was configred to block all incoming data from any instances of the lua executable that I was running to execute my LuaSocket scripts.

I was running one of these on my laptop in order to execute the client side scripts.

This explains why responses from the server (when hosted on the laptop) were getting through: because they were technically from the server and not from the executable and hence got through the firewall.

Once I allowed these connections, the server correctly recieves all packets directed to its port.