[Udpcast] does sender need to bind a socket to the multicast addr and receiver (portbase) port ?

Alain Knaff alain at knaff.lu
Tue Feb 16 00:11:00 CET 2010


Rodriguez Alban wrote:
> EDIT: it works with makeSocket only if I call htons() to the port  
> number:
> 
> mysock = makeSocket(ADDR_TYPE_MCAST,
> 			net_config->net_if,
> 			&net_config->dataMcastAddr,
> 			htons(RECEIVER_PORT(net_config->portBase)));
> 
> Other calls to makeSocket() doesn't use htons to swap the bytes so I  
> initially I wasn't doing either ...

makeSocket already does the byte-swapping itself (in the called function
 initSockAddress). So, by doing it here you really make it bind to a
different port than the intended one.

The effect would be the same as doing:

 mysock = makeSocket(ADDR_TYPE_MCAST,
 			net_config->net_if,
 			&net_config->dataMcastAddr,
 			RECEIVER_PORT(net_config->portBase)+2);

... or even suppressing that call altogether... Could you try whether
these 2 changes (or one of them) work with your hardware?

Regards,

Alain


More information about the Udpcast mailing list