src/share/classes/java/net/SocketOptions.java

Print this page

        

@@ -23,10 +23,12 @@
  * questions.
  */
 
 package java.net;
 
+import java.lang.annotation.Native;
+
 /**
  * Interface of methods to get/set socket options.  This interface is
  * implemented by: <B>SocketImpl</B> and  <B>DatagramSocketImpl</B>.
  * Subclasses of these should override the methods
  * of this interface in order to support their own options.

@@ -135,11 +137,11 @@
      * <P>
      * @see Socket#setTcpNoDelay
      * @see Socket#getTcpNoDelay
      */
 
-    public final static int TCP_NODELAY = 0x0001;
+    @Native public final static int TCP_NODELAY = 0x0001;
 
     /**
      * Fetch the local address binding of a socket (this option cannot
      * be "set" only "gotten", since sockets are bound at creation time,
      * and so the locally bound address cannot be changed).  The default local

@@ -156,30 +158,30 @@
      * <P>
      * @see Socket#getLocalAddress
      * @see DatagramSocket#getLocalAddress
      */
 
-    public final static int SO_BINDADDR = 0x000F;
+    @Native public final static int SO_BINDADDR = 0x000F;
 
     /** Sets SO_REUSEADDR for a socket.  This is used only for MulticastSockets
      * in java, and it is set by default for MulticastSockets.
      * <P>
      * Valid for: DatagramSocketImpl
      */
 
-    public final static int SO_REUSEADDR = 0x04;
+    @Native public final static int SO_REUSEADDR = 0x04;
 
     /**
      * Sets SO_BROADCAST for a socket. This option enables and disables
      * the ability of the process to send broadcast messages. It is supported
      * for only datagram sockets and only on networks that support
      * the concept of a broadcast message (e.g. Ethernet, token ring, etc.),
      * and it is set by default for DatagramSockets.
      * @since 1.4
      */
 
-    public final static int SO_BROADCAST = 0x0020;
+    @Native public final static int SO_BROADCAST = 0x0020;
 
     /** Set which outgoing interface on which to send multicast packets.
      * Useful on hosts with multiple network interfaces, where applications
      * want to use other than the system default.  Takes/returns an InetAddress.
      * <P>

@@ -187,11 +189,11 @@
      * <P>
      * @see MulticastSocket#setInterface(InetAddress)
      * @see MulticastSocket#getInterface()
      */
 
-    public final static int IP_MULTICAST_IF = 0x10;
+    @Native public final static int IP_MULTICAST_IF = 0x10;
 
     /** Same as above. This option is introduced so that the behaviour
      *  with IP_MULTICAST_IF will be kept the same as before, while
      *  this new option can support setting outgoing interfaces with either
      *  IPv4 and IPv6 addresses.

@@ -199,27 +201,27 @@
      *  NOTE: make sure there is no conflict with this
      * @see MulticastSocket#setNetworkInterface(NetworkInterface)
      * @see MulticastSocket#getNetworkInterface()
      * @since 1.4
      */
-    public final static int IP_MULTICAST_IF2 = 0x1f;
+    @Native public final static int IP_MULTICAST_IF2 = 0x1f;
 
     /**
      * This option enables or disables local loopback of multicast datagrams.
      * This option is enabled by default for Multicast Sockets.
      * @since 1.4
      */
 
-    public final static int IP_MULTICAST_LOOP = 0x12;
+    @Native public final static int IP_MULTICAST_LOOP = 0x12;
 
     /**
      * This option sets the type-of-service or traffic class field
      * in the IP header for a TCP or UDP socket.
      * @since 1.4
      */
 
-    public final static int IP_TOS = 0x3;
+    @Native public final static int IP_TOS = 0x3;
 
     /**
      * Specify a linger-on-close timeout.  This option disables/enables
      * immediate return from a <B>close()</B> of a TCP Socket.  Enabling
      * this option with a non-zero Integer <I>timeout</I> means that a

@@ -233,11 +235,11 @@
      * Valid only for TCP: SocketImpl
      *
      * @see Socket#setSoLinger
      * @see Socket#getSoLinger
      */
-    public final static int SO_LINGER = 0x0080;
+    @Native public final static int SO_LINGER = 0x0080;
 
     /** Set a timeout on blocking Socket operations:
      * <PRE>
      * ServerSocket.accept();
      * SocketInputStream.read();

@@ -254,11 +256,11 @@
      *
      * @see Socket#setSoTimeout
      * @see ServerSocket#setSoTimeout
      * @see DatagramSocket#setSoTimeout
      */
-    public final static int SO_TIMEOUT = 0x1006;
+    @Native public final static int SO_TIMEOUT = 0x1006;
 
     /**
      * Set a hint the size of the underlying buffers used by the
      * platform for outgoing network I/O. When used in set, this is a
      * suggestion to the kernel from the application about the size of

@@ -271,11 +273,11 @@
      * @see Socket#setSendBufferSize
      * @see Socket#getSendBufferSize
      * @see DatagramSocket#setSendBufferSize
      * @see DatagramSocket#getSendBufferSize
      */
-    public final static int SO_SNDBUF = 0x1001;
+    @Native public final static int SO_SNDBUF = 0x1001;
 
     /**
      * Set a hint the size of the underlying buffers used by the
      * platform for incoming network I/O. When used in set, this is a
      * suggestion to the kernel from the application about the size of

@@ -289,11 +291,11 @@
      * @see Socket#setReceiveBufferSize
      * @see Socket#getReceiveBufferSize
      * @see DatagramSocket#setReceiveBufferSize
      * @see DatagramSocket#getReceiveBufferSize
      */
-    public final static int SO_RCVBUF = 0x1002;
+    @Native public final static int SO_RCVBUF = 0x1002;
 
     /**
      * When the keepalive option is set for a TCP socket and no data
      * has been exchanged across the socket in either direction for
      * 2 hours (NOTE: the actual value is implementation dependent),

@@ -312,18 +314,18 @@
      * Valid only for TCP socket: SocketImpl
      *
      * @see Socket#setKeepAlive
      * @see Socket#getKeepAlive
      */
-    public final static int SO_KEEPALIVE = 0x0008;
+    @Native public final static int SO_KEEPALIVE = 0x0008;
 
     /**
      * When the OOBINLINE option is set, any TCP urgent data received on
      * the socket will be received through the socket input stream.
      * When the option is disabled (which is the default) urgent data
      * is silently discarded.
      *
      * @see Socket#setOOBInline
      * @see Socket#getOOBInline
      */
-    public final static int SO_OOBINLINE = 0x1003;
+    @Native public final static int SO_OOBINLINE = 0x1003;
 }