This is the mail archive of the ecos-discuss@sourceware.org mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: How to send UDP broadcast to 255.255.255.255?


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.

[snip]

>   if ((bytesSent = sendto(socket_fd, send_buf, packetSize, 0, (struct sockaddr *)&encoder_addr, sizeof encoder_addr)) == -1)

Hi,

I noticed one thing only. What's about sendto's flags? they talk about
`MSG_DONTROUTE' sendto flag for your needs:

packages/net/tcpip/current/doc/sendto.html

perhaps, that's it.

Sergei

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]