Sets traffic class or type-of-service octet in the IP
header for packets sent from this Socket.
As the underlying network implementation may ignore this
value applications should consider it a hint.
The tc must be in the range 0 <= tc <=
255
or an IllegalArgumentException will be thrown.
Notes:
For Internet Protocol v4 the value consists of an octet
with precedence and TOS fields as detailed in RFC 1349. The
TOS field is bitset created by bitwise-or'ing values such
the following :-
IPTOS_LOWCOST (0x02)
IPTOS_RELIABILITY (0x04)
IPTOS_THROUGHPUT (0x08)
IPTOS_LOWDELAY (0x10)
The last low order bit is always ignored as this
corresponds to the MBZ (must be zero) bit.
Setting bits in the precedence field may result in a
SocketException indicating that the operation is not
permitted.
As RFC 1122 section 4.2.4.2 indicates, a compliant TCP
implementation should, but is not required to, let application
change the TOS field during the lifetime of a connection.
So whether the type-of-service field can be changed after the
TCP connection has been established depends on the implementation
in the underlying platform. Applications should not assume that
they can change the TOS field after the connection.
For Internet Protocol v6 tc
is the value that
would be placed into the sin6_flowinfo field of the IP header.
Parameters:
- tc - an int
value for the bitset.
Throws:
- SocketException - if there is an error setting the
traffic class or type-of-service
Since:
1.4
See Also:
Socket.getTrafficClass()
,