FW: setTrafficClass on server socket; IP_TOS replacement on Windows

Michael McMahon Michael.McMahon at Sun.COM
Mon May 18 05:23:24 PDT 2009


Alan Bateman wrote:
>> setTrafficClass on a server socket, so that a certain TOS value will be
>> present in the ACK packet when TCP accepts a connection. This would 
>> occur
>> automatically because all socket flags are inherited during 
>> construction of
>> the native socket on the backlog queue, then Java turns off the timeout
>> setting when it constructs a Socket around it during accept() (which is
>> another historical curiousity AFAICS).
>>
>> I can't find my link to the NIO2 documentation but is there way to do 
>> that
>> in NIO2? Generally speaking it should be possible to (pre)-set every 
>> socket
>> option on a server socket.
>>   
> 1. I've just come across a situation where a user needs to call
> There is an RFE tracking this for java.net.ServerSocket:
>  http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6727157
>
> To my knowledge it hasn't been a priority (pun not intended), or are 
> least it is very rare to find anyone that needs it. Someone from the 
> networking group is best to respond to this but I suspect it needs a 
> broader re-examination of the QoS topic to see what, if anything, 
> should be done.
>
> QoS isn't in the scope of NIO2/JSR-203 which is why we didn't do 
> anything on this topic. However, we did define NetworkChannel and 
> retrofitted the existing network channels to implement it. That gives 
> us the flexibility to add implementation-specific socket options where 
> required (ie: don't need a setter/getter per option as we do with 
> classic networking).
>
We did something similar before in ServerSocket with the 
setReceiveBufferSize() method.
But if this is required for NIO, then adding it to ServerSocket, is 
probably not what you want.

- Michael




More information about the net-dev mailing list