This is the mail archive of the
mailing list for the eCos project.
Re: How to send UDP broadcast to 255.255.255.255?
- From: Sergei Gavrikov <sergei dot gavrikov at gmail dot com>
- To: Grant Edwards <grante at visi dot com>
- Cc: ecos-discuss at sources dot redhat dot com
- Date: Mon, 15 Jun 2009 23:36:31 +0300
- Subject: Re: [ECOS] How to send UDP broadcast to 255.255.255.255?
- References: <email@example.com>
Grant Edwards wrote:
> I've been asked by one of my internal customers how to send a
> UDP broadcast packet to IP address 255.255.255.255.
> I tried setting the SO_BROADCAST option on the socket and then
> using sendto() with a destination address of 255.255.255.255,
> but it sends to the subnet broadcast address (in my case
> 10.255.255.255) not to the global broadcast address of
> 255.255.255.255 that I specified in the sendto() call.
> if ((bytesSent = sendto(socket_fd, send_buf, packetSize, 0, (struct sockaddr *)&encoder_addr, sizeof encoder_addr)) == -1)
I noticed one thing only. What's about sendto's flags? they talk about
`MSG_DONTROUTE' sendto flag for your needs:
perhaps, that's it.
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss