I'm developing a program that uses UDP for transportation of data, it can send and receive if it's from the same machine but it fails to send over the Internet.
How do I make it work? I've forwarded the port in question on my router, does the other part have to forward aswell?
UDP routing
Re:UDP routing
Seems that it doesn't work over the network either... so, why can I only send and receive within the same machine?
sendto function returns -1 when I tried to send from another machine.
sendto function returns -1 when I tried to send from another machine.
Re:UDP routing
I'm sorry for posting again, I really should get an account so I can edit my posts :/
Anyway, which address should I bind the client peer to? The global Internet IP or the machine's local network IP?
If Internet IP: how do I get it? Calling the server using TCP, which responds with the IP?
And again; I'm sorry for posting three in a row.
Anyway, which address should I bind the client peer to? The global Internet IP or the machine's local network IP?
If Internet IP: how do I get it? Calling the server using TCP, which responds with the IP?
And again; I'm sorry for posting three in a row.
Re:UDP routing
IIRC, at least on Windows, you cannot bind to an IP that isn't directly owned by the system.
Since the call itself fails, are you binding to the loopback? You should bind to the network IP. I doubt it would be the router as UDP is send and forget, you won't know if it ever gets where it was sent.
Since the call itself fails, are you binding to the loopback? You should bind to the network IP. I doubt it would be the router as UDP is send and forget, you won't know if it ever gets where it was sent.
Re:UDP routing
Why not bind to 0.0.0.0 instead, which at least on Unix (IIRC) binds to all local IPs? I mean, that's normally the correct thing to do unless you have specific reasons to use more specific port to bind to.