Re: [twsocket] listening on two multicast sockets on the same port

2011-06-16 Thread Primoz Gabrijelcic
That was it! Thanks!

Primoz

> Hi Primoz,
> maybe the ReuseAddr property?

> This is my Implementation:

> procedure TUDP.StartRx;
> begin
>   Disconnect;
>   pLocalIP:=trim(pLocalIP);
>   if (pLocalIP<>'')and(pLocalPort>0) then
>   begin
> fWS.Proto:='udp';
> fWS.MultiThreaded:=pMultiThreaded;
> fWS.Addr:=pLocalIP;
> fWS.Port:=inttostr(pLocalPort);
> if fWS.Addr='' then
>   fWS.Addr:='0.0.0.0';
> if pMulticast then
> begin
>   fWS.MultiCast:=true;
>   fWS.ReuseAddr:=true;
>   fWS.MultiCastAddrStr:=pPeerIP;
> end;
> fWS.Listen;
> fWS.SocketRcvBufSize:=fRXSize;
> if pMulticast then

> setsockopt(fWS.HSocket,IPPROTO_IP,IP_MULTICAST_TTL,@pMulticastTTL,sizeof(pMulticastTTL));
>   end
>   else
> TLogger.Log('UDP socket start rx error LocalIP='+pLocalIP+'
> LocalPort='+inttostr(pLocalPort),lsError,true);
> end;


> Bye
> Emanuele


> Il 16/06/2011 12:29, Primoz Gabrijelcic ha scritto:
>> Hello, Everybody!
>> 
>> I have some problems with multicasting implementation, most probably
>> caused by my insufficient understanding of the subject.
>> 
>> I have multiple applications that can stream and listen on multicasted
>> traffic. Because I want them to bind only to one physical interface,
>> I'm initializing receiving socket as follows:
>> 
>> Port := 9200; // multicast port
>> Addr := '172.16.1.1'; // IP address of the physical adapter I want to 
>> bind to
>> MultiCastAddrStr := '239.192.1.1';
>> MultiCast := true;
>> Proto := 'udp';
>> 
>> This works fine as long as I only want to listen from one program on
>> this computer. As soon as I start the second instance which binds to
>> the same multicast address and port, the second .Listen fails with
>> error 10048.
>> 
>> I was living under understanding that it's entirely possible to listen
>> on the same multicast socket from more than one application on a
>> single computer and VLC player confirms me in those beliefs - I can
>> easily start two VLCs on same multicast address:port and both will
>> play incoming video.
>> 
>> Most probably the error is just in my understanding of how
>> multicasting is implemented inside ICS. Can you please point to the
>> error in my approach?
>> 
>> Best regards,
>> Primoz
>> 
>> --
>> 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


--
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


Re: [twsocket] listening on two multicast sockets on the same port

2011-06-16 Thread emanuele bizzarri
Hi Primoz,
maybe the ReuseAddr property?

This is my Implementation:

procedure TUDP.StartRx;
begin
  Disconnect;
  pLocalIP:=trim(pLocalIP);
  if (pLocalIP<>'')and(pLocalPort>0) then
  begin
fWS.Proto:='udp';
fWS.MultiThreaded:=pMultiThreaded;
fWS.Addr:=pLocalIP;
fWS.Port:=inttostr(pLocalPort);
if fWS.Addr='' then
  fWS.Addr:='0.0.0.0';
if pMulticast then
begin
  fWS.MultiCast:=true;
  fWS.ReuseAddr:=true;
  fWS.MultiCastAddrStr:=pPeerIP;
end;
fWS.Listen;
fWS.SocketRcvBufSize:=fRXSize;
if pMulticast then

setsockopt(fWS.HSocket,IPPROTO_IP,IP_MULTICAST_TTL,@pMulticastTTL,sizeof(pMulticastTTL));
  end
  else
TLogger.Log('UDP socket start rx error LocalIP='+pLocalIP+'
LocalPort='+inttostr(pLocalPort),lsError,true);
end;


Bye
Emanuele


Il 16/06/2011 12:29, Primoz Gabrijelcic ha scritto:
> Hello, Everybody!
> 
> I have some problems with multicasting implementation, most probably
> caused by my insufficient understanding of the subject.
> 
> I have multiple applications that can stream and listen on multicasted
> traffic. Because I want them to bind only to one physical interface,
> I'm initializing receiving socket as follows:
> 
> Port := 9200; // multicast port
> Addr := '172.16.1.1'; // IP address of the physical adapter I want to 
> bind to
> MultiCastAddrStr := '239.192.1.1';
> MultiCast := true;
> Proto := 'udp';
> 
> This works fine as long as I only want to listen from one program on
> this computer. As soon as I start the second instance which binds to
> the same multicast address and port, the second .Listen fails with
> error 10048.
> 
> I was living under understanding that it's entirely possible to listen
> on the same multicast socket from more than one application on a
> single computer and VLC player confirms me in those beliefs - I can
> easily start two VLCs on same multicast address:port and both will
> play incoming video.
> 
> Most probably the error is just in my understanding of how
> multicasting is implemented inside ICS. Can you please point to the
> error in my approach?
> 
> Best regards,
> Primoz
> 
> --
> 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

-- 
Ing. Emanuele Bizzarri
Software Development Department
e-works s.r.l.
41011 - Campogalliano - Modena - Italy
tel. +39 059 2929081 int. 23
fax +39 059 2925035

e-mail: e.bizza...@e-works.it - http://www.e-works.it
-
La presente comunicazione, che potrebbe contenere informazioni riservate
e/o protette da segreto professionale, è indirizzata esclusivamente ai
destinatari della medesima qui indicati. Le opinioni, le conclusioni e
le altre informazioni qui contenute, che non siano relative alla nostra
attività caratteristica, devono essere considerate come non inviate né
avvalorate da noi. Tutti i pareri e le informazioni qui contenuti sono
soggetti ai termini ed alle condizioni previsti dagli accordi che
regolano il nostro rapporto con il cliente. Nel caso in cui abbiate
ricevuto per errore la presente comunicazione, vogliate cortesemente
darcene immediata notizia, rispondendo a questo stesso indirizzo di
e-mail, e poi procedere alla cancellazione di questo messaggio dal
Vostro sistema. E' strettamente proibito e potrebbe essere fonte di
violazione di legge qualsiasi uso, comunicazione, copia o diffusione dei
contenuti di questa comunicazione da parte di chi la abbia ricevuta per
errore o in violazione degli scopi della presente.
-
This communication, that may contain confidential and/or legally
privileged information, is intended solely for the use of the intended
addressees. Opinions, conclusions and other information contained in
this message, that do not relate to the official business of this firm,
shall be considered as not given or endorsed by it. Every opinion or
advice contained in this communication is subject to the terms and
conditions provided by the agreement governing the engagement with such
a client. If you have received this communication in error, please
notify us immediately by responding to this email and then delete it
from your system. Any use, disclosure, copying or distribution of the
contents of this communication by a not-intended recipient or in
violation of the purposes of this communication is strictly prohibited
and may be unlawful.

--
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


[twsocket] listening on two multicast sockets on the same port

2011-06-16 Thread Primoz Gabrijelcic
Hello, Everybody!

I have some problems with multicasting implementation, most probably
caused by my insufficient understanding of the subject.

I have multiple applications that can stream and listen on multicasted
traffic. Because I want them to bind only to one physical interface,
I'm initializing receiving socket as follows:

Port := 9200; // multicast port
Addr := '172.16.1.1'; // IP address of the physical adapter I want to bind 
to
MultiCastAddrStr := '239.192.1.1';
MultiCast := true;
Proto := 'udp';

This works fine as long as I only want to listen from one program on
this computer. As soon as I start the second instance which binds to
the same multicast address and port, the second .Listen fails with
error 10048.

I was living under understanding that it's entirely possible to listen
on the same multicast socket from more than one application on a
single computer and VLC player confirms me in those beliefs - I can
easily start two VLCs on same multicast address:port and both will
play incoming video.

Most probably the error is just in my understanding of how
multicasting is implemented inside ICS. Can you please point to the
error in my approach?

Best regards,
Primoz

--
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