Reputation: 3
My problem is that I have more than one instance of my class, while trying to listen the same port. I've found that I can do it (listen on the same port) with the code I found (using the "ReuseAddress"), however it only works with multicast and broadcast packets, whilst I need unicast packets.
Anyone knows how I can make it work with unicast aswell?
Thanks.
Upvotes: 0
Views: 313
Reputation: 231163
Unfortunately, since UDP does not support the concept of a connection, it's usually not possible to bind multiple UDP sockets to the same local address:port pair. What you can do, however, is write your own wrapper around a single, shared UDP socket that figures out which client an incoming packet comes from, and routes it to the appropriate point within your own code.
Upvotes: 1