Hi,

I am trying to create a UDP broadcast server so that I can send out data to every computer on our local network for aircraft testing. I can get every component of the system to work except for the broadcast part... As I understand it, if I want to send a UDP packet as a broadcast, the only difference from a regular UDP communication is using setsockopts() to allow broadcast and sending to the address INADDR_BROADCAST. I would appreciate any help or comments from anyone who has worked with socket code in C.

Thanks!!

everyone who's ever gone through UDP and TCP socket programming has these issues.

as one of many who had to slog through it on my own, i can say that you'll love yourself better if you solve it yourself, rather than someone to tell you how to do it.

if it helps, you're on the right track and are almost there.

FWIW, Winsock2 (and even 1.1) is pretty solid, and well documented. it makes you almost want to like Microsoft until you recall that they copied it damn near wholesale from the BSD.

meh, whatever. it works well.

http://msdn.microsoft.com/en-us/library/ms740673%28VS.85%29.aspx

jephthah: This is a forum for developers to exchange ideas. Telling someone you have the answer, but "solve it yourself" is both infuriating and useless. Why don't you redeem yourself and post the answer to the question? Otherwise we will assume that you are ignorant and really do not have a solution.

everyone who's ever gone through UDP and TCP socket programming has these issues.

as one of many who had to slog through it on my own, i can say that you'll love yourself better if you solve it yourself, rather than someone to tell you how to do it.

commented: attaboy. you tell 'em +12

I realize this is long since a dead thread.. but since I know the answer.. maybe it's useful for someone:

If you have more than one network interface which is marked as being BROADCAST capable, sending to INADDR_BROADCAST will only send a packet out one of those interfaces.. and it may not be the interface you want. There are two solutions to this. 1) If you want to broadcast to just one network interface, use the broadcast address of that interface (easy to find out, just run ifconfig and it tells you). If you want to send to multiple interfaces, you need to either send multiple times, once to the broadcast address of each interface.. or you need to use ioctl to force your packet out through each interface in turn, using INADDR_BROADCAST for each one. There's no way to send once and have it go out multiple interfaces.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.