Non-standard socket options?

Alan Bateman Alan.Bateman at oracle.com
Fri May 10 04:22:34 PDT 2013


On 09/05/2013 21:49, Brian Call wrote:
> Hi Guys,
>
> My name is Brian Call and I'm a software developer for Sotera 
> Wireless. I'm currently developing a relatively complex multicast 
> application using the jdk7 selector-based I/O for multicast and I've 
> run in to a pretty major hurdle. By "complex", I mean that I have a 
> single bound socket joining multiple groups and it's critical that the 
> bound socket only receive traffic for groups it has joined. I'm 
> hitting the "promiscuous" traffic problem... and while bound to 
> 0.0.0.0 on linux I'm getting traffic for all multicast groups, even if 
> they were not specifically joined. In essence, there is no IP 
> stack-level filtering for datagrams by joined group on linux unless 
> you explicitly tell the stack to do so. Solaris and windows does the 
> filtering by default and Linux does not.
>
> Is there any way to make use of a non-standard socket option in Java? 
> Having spoken with Neil Horman lead networking developer over at Red 
> Hat, he mentioned that by passing in the socket option 
> IP_MULTICAST_ALL with a value of '0' it will disable UDP multiplexing 
> on Linux when bound to the wildcard address. This would definitely be 
> the hot move...
>
> If you have any insight into resolving the promiscuous multicast 
> traffic problem in Java, I'd be more than grateful.
Thanks for you mail. I wasn't aware of IP_MULTICAST_ALL, this is very 
useful to know because multicasting behavior on Linux has been painful 
because of works differently to other platforms (particularly Solaris, 
Mac and Windows). It may be that we need to consider setting 
IP_MULTICAST_ALL to 0 by default.

As regards platform specific socket options then it is possible for a 
JDK implementation to expose socket options beyond those specified. This 
is the rational for the NetworkChannel setOption/getOption methods. This 
isn't exactly what you want though, it's not a means to "bolt on" 
support for other socket options to an existing JDK build.

-Alan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/net-dev/attachments/20130510/5082edd7/attachment.html 


More information about the net-dev mailing list