It is possible that two programs are listening on the same UDP port, but both programs must indicate that they want to allow port sharing. Here is an excerpt from my code that tells the OS to do this (called just before calling bind () in UDP juice):
if (allowShared)
{
const int trueValue = 1;
setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &trueValue, sizeof(trueValue));
#ifdef __APPLE__
setsockopt(fd, SOL_SOCKET, SO_REUSEPORT, &trueValue, sizeof(trueValue));
#endif
}
source
share