Sets traffic class or type-of-service octet in the IP datagram header for datagrams sent from this DatagramSocket. 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
integer
, the least significant 8 bits of which
represent the value of the TOS octet in IP packets sent by
the socket.
RFC 1349 defines the TOS values as follows:
IPTOS_LOWCOST (0x02)
IPTOS_RELIABILITY (0x04)
IPTOS_THROUGHPUT (0x08)
IPTOS_LOWDELAY (0x10)
Setting bits in the precedence field may result in a SocketException indicating that the operation is not permitted.
for Internet Protocol v6 tc
is the value that
would be placed into the sin6_flowinfo field of the IP header.
tc | an int value for the bitset. |
SocketException | if there is an error setting the traffic class or type-of-service |
getTrafficClass
Diagram: Socket