Team LiB
Previous Section Next Section

SocketOptionsjava.net

Java 1.2

This interface defines constants that represent low-level BSD Unix-style socket options and methods that set and query the value of those options. In Java 1.2, SocketImpl and DatagramSocketImpl implement this interface. Any custom socket implementations you define should also provide meaningful implementations for the getOption( ) and setOption( ) methods. Your implementation may support options other than those defined here. Only custom socket implementations need to use this interface. All other code can use methods defined by Socket, ServerSocket, DatagramSocket, and MulticastSocket to set specific socket options for those socket types.

public interface SocketOptions {
// Public Constants
     public static final int IP_MULTICAST_IF;       =16
1.4  public static final int IP_MULTICAST_IF2;  =31
1.4  public static final int IP_MULTICAST_LOOP; =18
1.4  public static final int IP_TOS;            =3
     public static final int SO_BINDADDR;           =15
1.4  public static final int SO_BROADCAST;      =32
1.3  public static final int SO_KEEPALIVE;      =8
     public static final int SO_LINGER;             =128
1.4  public static final int SO_OOBINLINE;      =4099
     public static final int SO_RCVBUF;             =4098
     public static final int SO_REUSEADDR;          =4
     public static final int SO_SNDBUF;             =4097
     public static final int SO_TIMEOUT;            =4102
     public static final int TCP_NODELAY;           =1
// Public Instance Methods
     Object getOption(int optID) throws SocketException;  
     void setOption(int optID, Object value) throws SocketException;  
}

Implementations

DatagramSocketImpl, SocketImpl

    Team LiB
    Previous Section Next Section