How can I do broadcasting with pthread library?
I need a task to send a variable in broadcast way and periodically to N clients. I have to work and test the application in the same computer so I must give 127.0.0.1 and not a specific LAN's broadcast address. Beside all the clients need different ports for listening process...I am using C with pthreads' sockets and I can't change it, so how can I tell them to send broadcast and how can I give them all these different ports? I dont' want to make N socket for all this clients, I want to send this information ones and for all. Is there a way to implement this application with C and pthreads?
Thanks in advance.
- NeeblerLv 58 years agoBest Answer
This sounds like you want multicast. If possible, it's preferable to use UNIX domain sockets, otherwise you can use IP sockets.
Here is a good explanation with an example:
- 3 years ago
as long as they tell me what is going on interior the sport, i don't care. i do in contrast to whilst they start telling thoughts and that they forget relating to the sport for an prolonged time. i want to be attentive to what's going on! i detect comments relating to the pitcher or batter exciting, and how different video games are going. it particularly is in all threat a tough interest, you are able to fill 3 hours and talk approximately extra desirable than the sport- lifeless silence would not pass over so nicely.