It is impossible to set the TOS field of ip packets used for the TCP handshaking by using the provided interface for ServerSocket in the net library.