Example usage for java.net SocketOptions SO_SNDBUF

List of usage examples for java.net SocketOptions SO_SNDBUF

Introduction

In this page you can find the example usage for java.net SocketOptions SO_SNDBUF.

Prototype

int SO_SNDBUF

To view the source code for java.net SocketOptions SO_SNDBUF.

Click Source Link

Document

Set a hint the size of the underlying buffers used by the platform for outgoing network I/O.

Usage

From source file:org.apache.pig.shock.SSHSocketImplFactory.java

public Object getOption(int optID) throws SocketException {
    if (optID == SocketOptions.SO_SNDBUF)
        return Integer.valueOf(1024);
    else//from w  w w .j  av a2s  .co m
        throw new SocketException("SSHSocketImpl does not implement getOption for " + optID);
}

From source file:org.jnode.net.ipv4.tcp.TCPSocketImpl.java

/**
 * @see java.net.SocketOptions#getOption(int)
 *//*from   w  w  w.  j  a  v a2  s.  c o m*/
public Object getOption(int option_id) throws SocketException {
    switch (option_id) {
    case SocketOptions.SO_BINDADDR:
        return controlBlock.getLocalAddress().toInetAddress();
    case SocketOptions.SO_RCVBUF:
        return controlBlock.getReceiveBufferSize();
    case SocketOptions.SO_SNDBUF:
        return controlBlock.getSendBufferSize();
    case SocketOptions.SO_TIMEOUT:
        // todo implement it, 0 means disabled
        return 0;
    default:
        throw new SocketException("Option " + option_id + " is not recognised or not implemented");
    }
}