On Tuesday, October 08, 2013 9:58 PM [GMT+1=CET],
Markus Humm wrote:

> 3. I send UDP packets with a target address of 255.255.255.255
> 
> This works fine as long as only one network adapter is present in the
> system. 

AFAIK a broadcast target is always a network or subnet.
Hence if there are multiple networks connected to the computer you have
to broadcast to each of them. Here's a sample of how one gets the IPv4 
broadcast addresses with ICSv8: 

uses
  OverbyteIcsWinsock, OverbyteIcsWSocket,
  OverbyteIcsSocketUtils;

var
  IL: TInterfaceList;
  I: Integer;
const
  IFF_LOOPBACK = $00000004;
begin
  IL := TInterfaceList.Create;
  try
    IcsGetInterfaceList(IL);
    for I := 0 to IL.Count -1 do
    begin
      if (IL[I]^.iiAddress.AddressIn.sin_family = AF_INET) and (IL[I]^.iiFlags 
and IFF_LOOPBACK = 0) then // IPv4 no loopback
          
Memo1.Lines.Add(string(WSocket_inet_ntoa(IL[I]^.iiBroadcastAddress.AddressIn.sin_addr)));
    end;
  finally
    IL.Free;
  end;

-- 
Arno
   
-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

Reply via email to