0

i want to use websockets in my java application, but have to specify the TOS flag. Is there a common way to do this properly? how do i configure socket settings typically? thanks in advance!

Thomas
  • 1

1 Answers1

0

This can be done with the setTrafficClass(int) method from the java.net.Socket class. The JavaDoc has a good description of the allowed parameter values and what it refers to:

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.

Community
  • 1
  • 1
Jack
  • 2,937
  • 5
  • 34
  • 44