From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!feeder.eternal-september.org!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Broadcasting UDP Date: Mon, 25 Apr 2016 16:51:05 +0200 Organization: Aioe.org NNTP Server Message-ID: References: <276b8c43-7280-48ad-94be-c8324c6ae326@googlegroups.com> <0ea06785-65e5-4c33-b8b1-1fc6e7e66740@googlegroups.com> NNTP-Posting-Host: G7MXAklp0OAVRSdfcmpxRQ.user.gioia.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.0 X-Notice: Filtered by postfilter v. 0.8.2 Xref: news.eternal-september.org comp.lang.ada:30279 Date: 2016-04-25T16:51:05+02:00 List-Id: On 25/04/2016 16:18, ahlan@marriott.org wrote: > This of course works but by using Broadcast_Inet_Addr > (255.255.255.255) then we actually transmit more UDP messages than is > strictly necessary. > > For example if I have two adapters one with 100.13.5.200 and the > other 169.254.7.7 and I send a UDP broadcast on each adapter then four UDP > messages are actually transmitted. > 1) Src=100.13.5.200 Dest=255.255.255.255 on adapter 1 > 2) Src=100.13.5.200 Dest=255.255.255.255 on adapter 2 > 3) Src=169.254.7.7 Dest=255.255.255.255 on adapter 1 > 4) Src=169.254.7.7 Dest=255.255.255.255 on adapter 2 > > This is because the destination address 255.255.255.255 is for all adapters. But the socket is bound to the address of a concrete adapter. Send_Socket should not leak through another adapter. It does not look right. > If I could find out the subnet masks I could derive the subnet > directed broadcast addresses and use these as the destination addresses > and thereby reduce the traffic. AFAIK there is no means for that in the Berkeley sockets. > Not by much I grant you but every little helps and besides it would > be a little more elegant than using the crude broadcast to all on all > adapters approach. Broadcasts with alien source address is not a big problem. I hope you are not doing anything but network discovery over broadcast. > Any ideas? Maybe, there is something with network settings (bridging etc). Broadcast packets should not cross segment boundaries. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de