-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 Gurkan,
On 5/29/19 02:28, Gurkan Erdogdu wrote: > Hi In an McastServiceImpl#setupSocket method, if the user > configures the mcastBindAddress, it will use the socket to bind to > this address. But, in the code below, it uses the "address" field > while creating the socket. Is this correct ? > > if (mcastBindAddress != null) { try { > log.info(sm.getString("mcastServiceImpl.bind", address, > Integer.toString(port))); socket = new MulticastSocket(new > InetSocketAddress(address,port)); } catch (BindException e) { That definitely does look weird. The constructor for McastServiceImpl is even more strange: /** * @param bind - the bind address (not sure this is used yet) * @param mcastAddress - the mcast address */ public McastServiceImpl([...], InetAddress bind, InetAddress mcastAddress, [...]) throws IOException { [...] this.address = mcastAddress; this.mcastBindAddress = bind; [...] } There are two items, here: 1. An address to bind to (locally) 2. A multicast target address The constructor takes these two and calls them: 1. bind 2. mcastAddress But the class members are called: 1. mcastBindAddress 2. address The mcastBindAddress appears to be ignored in all but one place, where the socket's interface is changed to it at McastServiceImpl.java:223: 220 if (mcastBindAddress != null) { 221 if(log.isInfoEnabled()) 222 log.info(sm.getString("mcastServiceImpl.setInterface", mcastBindAddress)); 223 socket.setInterface(mcastBindAddress); 224 } //end if I don't know enough about multicast to know what is supposed to be happening, here. AFAIK, mcast is a broadcast mechanism and so there is no difference between the "target" address and the "bind" address: you just throw packets at the interface:port and that's that. The code could probably use some clean-up, or at least some better in-code documentation by someone who has a good understanding of the whole situation. - -chris -----BEGIN PGP SIGNATURE----- Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/ iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAlzv7ysACgkQHPApP6U8 pFjuNg/8DkSdnsKkoTmGS1N37IXVcdj5cyHlmPC+BdP3NWE4oky0j5uFrGUqcaRG UJLsPMvtZwgSaQ/wxgin4maluAmK77Agt76r6tXJNbbpdglXVyz7ONWO8a5xmk9R ltqLWnHVw4a/HB5vatxFgqWWc6L1qWnocJL7/sWUn1M9y9Ee43/+h5OYnaBn9bCM R1jqVhZAodC2k1eD3HXedCMaVIA4k2fZF+TteOHNu2rDr01mJVZzPjNJ/zy4sNg7 L0P0uuqCp3ylh563c3t+slL/9XFoVDNytD46qJlmDDcOYczNjf5An6dyWBJEX348 d0FdWOw5h45lJKhMd1L9WNLymxj3gQ9a3okfhiEqyunsZA4SbMNCPgy4an8tzBsd HsX1dNgD6P8aoy2umG6SvqgAoPb0mZxlVVT1NdbXN0uybdv/mUJgjDHNsbaCYOxG UNBfT/p5VQxURhRuNqHsFYvHtA6pxt8mZBbwsHC6b/uOYgPXPrLbM4oQztF2YEzI RDOr2kmA+JbEj5qKOeQa3BVGT5bUeLRWH+fDFiXq6ubdBdvHAifPJyGdYgAFLvZq jm85WJJeNvluwB602JUJ/FFxCYe6sKL7jaqfZJClqZrscUDxve0Fckh9xLrQ/il2 0W1VqfxuWeFL6P0SgJOr7aZxbdA293o1/X10E9o6sMuWoCtHfk8= =jSBA -----END PGP SIGNATURE----- --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org