0
votes

When I'm trying to bind a UDP socket on a specific ip (other than 127.0.0.1/INADDR_LOOPBACK or 0.0.0.0/INADDR_ANY) it fails.

I need to have a dedicated UDP socket for each client (point to point connection).

If I don't bind the socket and use sendto and recvfrom function, the data never arrives.

Any obvious solution ?

1
You might get a more feedback if you provide the error code that indicates the failure. Even better, provide a very short snippet of code that demonstrates the failure. The post as it stands now is rather light on information.Mark Wilkins
I think you're looking for the connect() method. Otherwise I don't know why you think you need a UDP socket per client.user207421
Actualy it's more a theoretical miss understanding from me about udp usage. But duskwff gave me all I needed to know for this problemJuskie

1 Answers

0
votes

You can't bind UDP sockets to nonlocal addresses -- binding a UDP socket to an address means that you want packets that are directed to that address, not ones that are being sent from that address. You'll need to figure out some way to share a single socket across all clients.