These are chat archives for IndySockets/Indy

11th
Jul 2017
DelphiWorlds
@DelphiWorlds
Jul 11 2017 13:48
I'm back on the Multicast issue - it seems I just need to find a multicast group that works. The information available is pretty confusing, as is iOS's apparent refusal to accept what I thought are valid groups. Any ideas on how to find something definitive?
I'm using a TIdIPMCastClient, and the following code:
procedure TForm1.FormCreate(Sender: TObject);
var
  I: Integer;
begin
  BroadcastListenerIPv6.DefaultPort := 6000;
  for I := 0 to BroadcastListenerIPv6.Bindings.Count - 1 do
    BroadcastListenerIPv6.Bindings.Items[I].Port := BroadcastListenerIPv6.DefaultPort;
  BroadcastListenerIPv6.MulticastGroup := 'FF02:0:0:0:0:0:0:1';
  BroadcastListenerIPv6.Active := True;
end;
Remy Lebeau
@rlebeau
Jul 11 2017 21:04
@DelphiWorlds Obviously, you have to use whatever group IP is actually running on your local network. Is there an actual multicast group FF02:0:0:0:0:0:0:1 on your network?
DelphiWorlds
@DelphiWorlds
Jul 11 2017 21:24
That's my point.. how do I know if there is one? Do I actually need to create it, and how?
Remy Lebeau
@rlebeau
Jul 11 2017 21:26
@DelphiWorlds of course you need to have something setup on the network that will be sending packets to the group, and you need to know what that group is ahead of time. What else are you going to listen for packets from? TIdIPMCastClient joins a group. Anyone can send packets to the same group, and they will be delivered to whoever is joined
DelphiWorlds
@DelphiWorlds
Jul 11 2017 21:30
procedure TForm1.FormCreate(Sender: TObject);
var
  I: Integer;
begin
  BroadcastServerIPv6.Port := 6000;
  BroadcastServerIPv6.MulticastGroup := 'FF02:0:0:0:0:0:0:1';
  BroadcastServerIPv6.Active := True;

  BroadcastListenerIPv6.DefaultPort := 6000;
  for I := 0 to BroadcastListenerIPv6.Bindings.Count - 1 do
    BroadcastListenerIPv6.Bindings.Items[I].Port := BroadcastListenerIPv6.DefaultPort;
  BroadcastListenerIPv6.MulticastGroup := 'FF02:0:0:0:0:0:0:1';
  BroadcastListenerIPv6.Active := True;
end;
Still does not work
Same error, i.e. 49 (Address invalid)
Remy Lebeau
@rlebeau
Jul 11 2017 23:51
@DelphiWorlds well, you didn't say that earlier. That is an OS error, not an Indy error. Where exactly are you seeing that error? What local IP(s) are you binding the client to? You are only setting TIdSocketHandle.Port in code, are you leaving TIdSocketHandle.IP blank? I don't know if you can do that when joining a multicast group as a client
DelphiWorlds
@DelphiWorlds
Jul 11 2017 23:58
when setsockopt is called.. that returns -1, and WSGetLastError returns 49
the client binds to a zero address (apparently meaning all)
Remy Lebeau
@rlebeau
Jul 11 2017 23:59
@DelphiWorlds when calling setsockopt() with IPV6_ADD_MEMBERSHIP? It binds to interface index 0 (not address 0), which means use the default multicast interface.
DelphiWorlds
@DelphiWorlds
Jul 11 2017 23:59
when calling setsockopt() with IPV6_ADD_MEMBERSHIP it passes the group, not an IP address