Advertisement
Guest User

Untitled

a guest
Jul 18th, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.46 KB | None | 0 0
  1. public class SocketHints {
  2.  
  3. /** The connection timeout in milliseconds. Not used for sockets created via server.accept(). */
  4. public int connectTimeout = 5000;
  5.  
  6. /** Performance preferences are described by three integers whose values indicate the relative importance of short connection
  7. * time, low latency, and high bandwidth. The absolute values of the integers are irrelevant; in order to choose a protocol the
  8. * values are simply compared, with larger values indicating stronger preferences. Negative values represent a lower priority
  9. * than positive values. If the application prefers short connection time over both low latency and high bandwidth, for
  10. * example, then it could invoke this method with the values (1, 0, 0). If the application prefers high bandwidth above low
  11. * latency, and low latency above short connection time, then it could invoke this method with the values (0, 1, 2). */
  12. public int performancePrefConnectionTime = 0;
  13. public int performancePrefLatency = 1; // low latency
  14. public int performancePrefBandwidth = 0;
  15. /** The traffic class describes the type of connection that shall be established. The traffic class must be in the range 0 <=
  16. * trafficClass <= 255.
  17. * <p>
  18. * The traffic class is bitset created by bitwise-or'ing values such the following :
  19. * <ul>
  20. * <li>IPTOS_LOWCOST (0x02) - cheap!
  21. * <li>IPTOS_RELIABILITY (0x04) - reliable connection with little package loss.
  22. * <li>IPTOS_THROUGHPUT (0x08) - lots of data being sent.
  23. * <li>IPTOS_LOWDELAY (0x10) - low delay.
  24. * </ul> */
  25. public int trafficClass = 0x14; // low delay + reliable
  26. /** True to enable SO_KEEPALIVE. */
  27. public boolean keepAlive = true;
  28. /** True to enable TCP_NODELAY (disable/enable Nagle's algorithm). */
  29. public boolean tcpNoDelay = true;
  30. /** The SO_SNDBUF (send buffer) size in bytes. */
  31. public int sendBufferSize = 4096;
  32. /** The SO_RCVBUF (receive buffer) size in bytes. */
  33. public int receiveBufferSize = 4096;
  34. /** Enable/disable SO_LINGER with the specified linger time in seconds. Only affects socket close. */
  35. public boolean linger = false;
  36. /** The linger duration in seconds (NOT milliseconds!). Only used if linger is true! */
  37. public int lingerDuration = 0;
  38. /** Enable/disable SO_TIMEOUT with the specified timeout, in milliseconds. With this option set to a non-zero timeout, a read()
  39. * call on the InputStream associated with this Socket will block for only this amount of time */
  40. public int socketTimeout = 0;
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement