Lorenz Breu wrote:
Try Multicast.loopback if Multicast.join fails.
Win32 is pretty weired, and not sure why the join doesn't work.
I suppose the multicast group needs to exists before joining.
no cigar. i first expected an APR_ENOTIMPL or even a failure, but i get
APR_SUCCESS all the way... but nothing actually happens... works fine
with linux though, so i guess it's either me being lucky that linux is
catching my mistake, or there being a problem with the apr code on my
win32 machine (xp pro).
do i need to specify a source when i join a group? isn't NOT specifying
one safer than specifying one, as i want to accept all muslticast
messages to that address, no matter where they come from??
here is what i have been doing:
i actually used 0 instead of the specific interface, then i thought
windows may need to be specified an address, but both approaches do the
same thing: return success and do nothing. all individual steps below
return APR_SUCCESS.
long ifa = Address.info("192.168.2.100", Socket.APR_INET, 0, 0, pool);
You can use "0.0.0.0" here.
Multicast.ointerface(handle, ifa);
No need to call this.
long ra;
ra = Address.info("234.255.255.253", 0, 0, 0, pool);
You need a port here.
Multicast.loopback(handle, true);
Multicast.join(handle, ra, ifa, 0);
Socket.optSet(handle, Socket.APR_SO_NONBLOCK, 1);
Socket.timeoutSet(handle, 0);
Socket.optSet(handle, Socket.APR_SO_REUSEADDR, 1);
Socket.optSet(handle, Socket.APR_SO_RCVBUF,
getSessionConfig().getReceiveBufferSize());
long sa;
sa = Address.info(la.getAddress().getHostAddress(), Socket.APR_INET,
la.getPort(), 0, pool);
result = Socket.bind(handle, sa);
Here is the correct algo for sender:
ifa = Address.info(null, Socket.APR_INET, Socket.APR_UNSPEC, 0, pool).
mca = Address.info("234.255.255.253", Socket.APR_INET,
Socket.APR_UNSPEC, 25000, pool);
Socket.optSet(handle, Socket.APR_SO_REUSEADDR, 1);
result = Socket.bind(handle, ifa);
Multicast.join(handle, mca, ifa, 0);
Regards
--
^(TM)
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org