Cannot communicate with UDPsend/receive

warp1's icon

This is an unbelievably 101 issue, but it is mystifying me.

I am testing a 'hello' patch using udpsend with IP address followed by port number. on my colleague's side they are using udpreceive with the same port number. I am running a number box through the connection.

The other side does not receive anything when I run the numbers. When I run it between 2 computers on my home network, it works perfectly. Is there something about the UDP protocol that breaks when trying to communicate between 2 different networks? This is a connection between UK and US.

I cannot believe that there would be anything prohibiting this from working, and in fact I have done it many times before. I am on Max 8, they are on Max 7 (although I did exactly the same test with someone else on Max 8). Can anyone tell me what I am doing wrong??

Pedro Santos's icon

Is there something about the UDP protocol that breaks when trying to communicate between 2 different networks? This is a connection between UK and US.

Not about the UDP protocol specifically, but about the whole networking principles. When you're trying to communicate on the same network, you send the UDP data to the local IP address of the other machine and define a specific port (e.g, udpsend 192.168.0.12 9000).

When communicating with someone on another network, there are more concerns and configurations to take care of: gateway, NAT, firewalls, port forwarding. Look for explanations of these principles on the internet. For instance, a quick Google search returned these results:
https://askleo.com/how_does_nat_work/
https://askleo.com/your-routers-two-ip-addresses/

Anyway, I'll try to summarize some guidelines:

  1. The problem derives from the fact that usually you have 3 networks involved: (Your local network) (the Internet) (His local network)

  2. You need to know and use the internet/public IP address of your colleague, not the local one. Ask him to type "my ip address" in Google and give you the address. Use that address when using "udpsend".

  3. By sending to that IP address, you're only guaranteeing that the information reaches its router/gateway (i.e, the device directly connected to the internet), not the actual computer running Max inside his local network. He should make some sort of rule on the router to configure that incoming information on the specified port (e.g. 9000) should be delivered to the local IP address of his Max computer.

  4. Make sure that there are no Firewalls on both ends configured to block the information on the port(s) you're using to communicate.