java.net
Interface SocketOptions
- DatagramSocketImpl, NIOSocketImpl, PlainDatagramSocketImpl, PlainSocketImpl, SocketImpl
This interface is used by SocketImpl
and
DatagramSocketImpl
to implement options
on sockets.
static int | IP_MULTICAST_IF - Options id for the IP_MULTICAST_IF value
|
static int | IP_MULTICAST_IF2 - same as above
|
static int | IP_MULTICAST_LOOP - This option enables or disables local loopback of multicast datagrams.
|
static int | IP_TOS - This option sets the type-of-service or traffic class field in the
IP header for a TCP or UDP socket.
|
static int | SO_BINDADDR - Retrieve the local address to which the socket is bound.
|
static int | SO_BROADCAST - Sets SO_BROADCAST for a socket
|
static int | SO_KEEPALIVE - Option id for the SO_KEEPALIVE value
|
static int | SO_LINGER - Option id for the SO_LINGER value
|
static int | SO_OOBINLINE - Sets SO_OOBINLINE for a socket
|
static int | SO_RCVBUF - Option id for the receive buffer size
|
static int | SO_REUSEADDR - Sets the SO_REUSEADDR parameter on a socket
|
static int | SO_SNDBUF - Option id for the send buffer size
|
static int | SO_TIMEOUT - Option id for the SO_TIMEOUT value
|
static int | TCP_NODELAY - Option id for the TCP_NODELAY value
|
Object | getOption(int optionId) - Returns the current setting of the specified option.
|
void | setOption(int optionId, Object val) - Sets the specified option on a socket to the passed in object.
|
getOption
public Object getOption(int optionId)
throws SocketException
Returns the current setting of the specified option. The
Object
returned will be an Integer
for options
that have integer values. For options that are set to on or off, a
Boolean
will be returned. The optionId
parameter is one of the defined constants in this interface.
optionId
- The option identifier
- The current value of the option
setOption
public void setOption(int optionId,
Object val)
throws SocketException
Sets the specified option on a socket to the passed in object. For
options that take an integer argument, the passed in object is an
Integer
. For options that are set to on or off, the
value passed will be a Boolean
. The optionId
parameter is one of the defined constants in this interface.
optionId
- The identifier of the optionval
- The value to set the option to
SocketOptions.java -- Implements options for sockets (duh!)
Copyright (C) 1998, 1999, 2000, 2001,
2002, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version.