DatagramSocketBufferControl

Overview | Package | Class | Use | Tree | Deprecated | Index | Help

PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.dvb.net
Class DatagramSocketBufferControl

    java.lang.Object
      org.dvb.net.DatagramSocketBufferControl

    public class DatagramSocketBufferControl

extends Object

This class provides additional control over buffering for `DatagramSocket`s.

Method Summary
`static int` | `getReceiveBufferSize(DatagramSocket d)` Get value of the SO_RCVBUF option for this socket, that is the buffer size used by the platform for input on the this Socket.
`static void` | `setReceiveBufferSize(DatagramSocket d, int size)` Sets the SO_RCVBUF option to the specified value for this DatagramSocket.

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Method Detail

### setReceiveBufferSize

    public static void setReceiveBufferSize(DatagramSocket d,
                                            int size)
                                     throws SocketException

  Sets the SO_RCVBUF option to the specified value for this DatagramSocket. The SO_RCVBUF option is used by the platform's networking code as a hint for the size to use when allocating the underlying network I/O buffers.

  Increasing buffer size can increase the performance of network I/O for high-volume connection, while decreasing it can help reduce the backlog of incoming data. For UDP, this sets the buffer size for received packets.

  Because SO_RCVBUF is a hint, applications that want to verify what size the buffers were set to should call getReceiveBufferSize. This method shall throw IllegalArgumentException - if size is 0 or is negative.

  Parameters:
    `d` - The DatagramSocket for which to change the receive buffer size.
    `size` - The requested size of the receive buffer, in bytes.
  Throws:
    `SocketException` - - If there is an error when setting the SO_RCVBUF option.

### getReceiveBufferSize

    public static int getReceiveBufferSize(DatagramSocket d)
                                    throws SocketException

  Get value of the SO_RCVBUF option for this socket, that is the buffer size used by the platform for input on the this Socket. The value returned need not be the value previously set by setReceiveBufferSize (if any).

  Parameters:
    `d` - The DatagramSocket for which to query the receive buffer size.
  Returns:
    The size of the receive buffer, in bytes.
  Throws:
    `SocketException` - - If there is an error when querying the SO_RCVBUF option.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help

PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD