Page 1 of 1

UDP routing

Posted: Wed Aug 03, 2005 3:09 pm
by ohboy
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?

Re:UDP routing

Posted: Wed Aug 03, 2005 3:32 pm
by ohboy
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.

Re:UDP routing

Posted: Thu Aug 04, 2005 9:55 am
by ohboy
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.

Re:UDP routing

Posted: Thu Aug 04, 2005 5:25 pm
by AR
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.

Re:UDP routing

Posted: Thu Aug 04, 2005 6:04 pm
by mystran
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.