Build 1.1_r1 (from source)

java.net
Class Socket

java.lang.Object
  extended by java.net.Socket
Direct Known Subclasses:
SSLSocket

public class Socket
extends Object

Provides a client-side TCP socket.

Since:
Android 1.0

Field Summary
(package private) static SocketImplFactory factory
           
(package private) static int FLAG_SHUTDOWN
           
(package private)  SocketImpl impl
           
(package private) static int MULTICAST_IF
           
(package private) static int MULTICAST_TTL
           
(package private) static int TCP_NODELAY
           
 
Constructor Summary
  Socket()
          Creates a new unconnected socket.
  Socket(InetAddress dstAddress, int dstPort)
          Creates a new streaming socket connected to the target host specified by the parameters dstAddress and dstPort.
  Socket(InetAddress addr, int port, boolean streaming)
          Deprecated. Use Socket(InetAddress, int) instead of this for streaming sockets or an appropriate constructor of DatagramSocket for UDP transport.
  Socket(InetAddress dstAddress, int dstPort, InetAddress localAddress, int localPort)
          Creates a new streaming socket connected to the target host specified by the parameters dstAddress and dstPort.
  Socket(Proxy proxy)
          Creates a new unconnected socket using the given proxy type.
protected Socket(SocketImpl anImpl)
          Creates an unconnected socket with the given socket implementation.
  Socket(String dstName, int dstPort)
          Creates a new streaming socket connected to the target host specified by the parameters dstName and dstPort.
  Socket(String hostName, int port, boolean streaming)
          Deprecated. Use Socket(String, int) instead of this for streaming sockets or an appropriate constructor of DatagramSocket for UDP transport.
  Socket(String dstName, int dstPort, InetAddress localAddress, int localPort)
          Creates a new streaming socket connected to the target host specified by the parameters dstName and dstPort.
 
Method Summary
(package private)  void accepted()
          Set the appropriate flags for a socket created by ServerSocket.accept().
 void bind(SocketAddress localAddr)
          Binds this socket to the given local host address and port specified by the SocketAddress localAddr.
(package private)  void checkDestination(InetAddress destAddr, int dstPort)
          Checks whether the connection destination satisfies the security policy and the validity of the port range.
 void close()
          Closes the socket.
 void connect(SocketAddress remoteAddr)
          Connects this socket to the given remote host address and port specified by the SocketAddress remoteAddr.
 void connect(SocketAddress remoteAddr, int timeout)
          Connects this socket to the given remote host address and port specified by the SocketAddress remoteAddr with the specified timeout.
 SocketChannel getChannel()
          Gets the SocketChannel of this socket, if one is available.
 InetAddress getInetAddress()
          Gets the IP address of the target host this socket is connected to.
 InputStream getInputStream()
          Gets an input stream to read data from this socket.
 boolean getKeepAlive()
          Gets the setting of the socket option SocketOptions.SO_KEEPALIVE.
 InetAddress getLocalAddress()
          Gets the local IP address this socket is bound to.
 int getLocalPort()
          Gets the local port this socket is bound to.
 SocketAddress getLocalSocketAddress()
          Gets the local address and port of this socket as a SocketAddress or null if the socket is unbound.
 boolean getOOBInline()
          Gets the setting of the socket option SocketOptions.SO_OOBINLINE.
 OutputStream getOutputStream()
          Gets an output stream to write data into this socket.
 int getPort()
          Gets the port number of the target host this socket is connected to.
 int getReceiveBufferSize()
          Gets the receive buffer size of this socket.
 SocketAddress getRemoteSocketAddress()
          Gets the remote address and port of this socket as a SocketAddress or null if the socket is not connected.
 boolean getReuseAddress()
          Gets the setting of the socket option SocketOptions.SO_REUSEADDR.
 int getSendBufferSize()
          Gets the send buffer size of this socket.
 int getSoLinger()
          Gets the value of the socket option SocketOptions.SO_LINGER.
 int getSoTimeout()
          Gets the timeout for this socket during which a reading operation shall block while waiting for data.
 boolean getTcpNoDelay()
          Gets the setting of the socket option SocketOptions.TCP_NODELAY.
 int getTrafficClass()
          Gets the value of the socket option SocketOptions.IP_TOS.
 boolean isBound()
          Returns whether this socket is bound to a local address and port.
 boolean isClosed()
          Returns whether this socket is closed.
 boolean isConnected()
          Returns whether this socket is connected to a remote host.
 boolean isInputShutdown()
          Returns whether the incoming channel of the socket has already been closed.
 boolean isOutputShutdown()
          Returns whether the outgoing channel of the socket has already been closed.
(package private) static boolean preferIPv4Stack()
           
 void sendUrgentData(int value)
          Sends the given single byte data which is represented by the lowest octet of value as "TCP urgent data".
 void setKeepAlive(boolean value)
          Sets the state of the SocketOptions.SO_KEEPALIVE for this socket.
 void setOOBInline(boolean oobinline)
          Sets the state of the SocketOptions.SO_OOBINLINE for this socket.
 void setPerformancePreferences(int connectionTime, int latency, int bandwidth)
          Sets performance preferences for connectionTime, latency and bandwidth.
 void setReceiveBufferSize(int size)
          Sets the receive buffer size of this socket.
 void setReuseAddress(boolean reuse)
          Sets the state of the SocketOptions.SO_REUSEADDR for this socket.
 void setSendBufferSize(int size)
          Sets the send buffer size of this socket.
static void setSocketImplFactory(SocketImplFactory fac)
          Sets the internal factory for creating socket implementations.
 void setSoLinger(boolean on, int timeout)
          Sets the state of the SocketOptions.SO_LINGER with the given timeout in seconds.
 void setSoTimeout(int timeout)
          Sets the reading timeout in milliseconds for this socket.
 void setTcpNoDelay(boolean on)
          Sets the state of the SocketOptions.TCP_NODELAY for this socket.
 void setTrafficClass(int value)
          Sets the value of the SocketOptions.IP_TOS for this socket.
 void shutdownInput()
          Closes the input stream of this socket.
 void shutdownOutput()
          Closes the output stream of this socket.
(package private)  void startupSocket(InetAddress dstAddress, int dstPort, InetAddress localAddress, int localPort, boolean streaming)
          Creates a stream socket, binds it to the nominated local address/port, then connects it to the nominated destination address/port.
 String toString()
          Returns a String containing a concise, human-readable description of the socket.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

impl

SocketImpl impl

factory

static SocketImplFactory factory

MULTICAST_IF

static final int MULTICAST_IF
See Also:
Constant Field Values

MULTICAST_TTL

static final int MULTICAST_TTL
See Also:
Constant Field Values

TCP_NODELAY

static final int TCP_NODELAY
See Also:
Constant Field Values

FLAG_SHUTDOWN

static final int FLAG_SHUTDOWN
See Also:
Constant Field Values
Constructor Detail

Socket

public Socket()
Creates a new unconnected socket. When a SocketImplFactory is defined it creates the internal socket implementation, otherwise the default socket implementation will be used for this socket.

Since:
Android 1.0
See Also:
SocketImplFactory, SocketImpl

Socket

public Socket(Proxy proxy)
Creates a new unconnected socket using the given proxy type. When a SocketImplFactory is defined it creates the internal socket implementation, otherwise the default socket implementation will be used for this socket.

Example that will create a socket connection through a SOCKS proxy server:
Socket sock = new Socket(new Proxy(Proxy.Type.SOCKS, new InetSocketAddress("test.domain.org", 2130)));

Parameters:
proxy - the specified proxy for this socket.
Throws:
IllegalArgumentException - if the argument proxy is null or of an invalid type.
SecurityException - if a security manager exists and it denies the permission to connect to the given proxy.
Since:
Android 1.0
See Also:
SocketImplFactory, SocketImpl

Socket

public Socket(String dstName,
              int dstPort)
       throws UnknownHostException,
              IOException
Creates a new streaming socket connected to the target host specified by the parameters dstName and dstPort. The socket is bound to any available port on the local host.

Parameters:
dstName - the target host name or IP address to connect to.
dstPort - the port on the target host to connect to.
Throws:
UnknownHostException - if the host name could not be resolved into an IP address.
IOException - if an error occurs while creating the socket.
SecurityException - if a security manager exists and it denies the permission to connect to the given address and port.
Since:
Android 1.0

Socket

public Socket(String dstName,
              int dstPort,
              InetAddress localAddress,
              int localPort)
       throws IOException
Creates a new streaming socket connected to the target host specified by the parameters dstName and dstPort. On the local endpoint the socket is bound to the given address localAddress on port localPort. If host is null a loopback address is used to connect to.

Parameters:
dstName - the target host name or IP address to connect to.
dstPort - the port on the target host to connect to.
localAddress - the address on the local host to bind to.
localPort - the port on the local host to bind to.
Throws:
UnknownHostException - if the host name could not be resolved into an IP address.
IOException - if an error occurs while creating the socket.
SecurityException - if a security manager exists and it denies the permission to connect to the given address and port.
Since:
Android 1.0

Socket

@Deprecated
public Socket(String hostName,
                         int port,
                         boolean streaming)
       throws IOException
Deprecated. Use Socket(String, int) instead of this for streaming sockets or an appropriate constructor of DatagramSocket for UDP transport.

Creates a new streaming or datagram socket connected to the target host specified by the parameters hostName and port. The socket is bound to any available port on the local host.

Parameters:
hostName - the target host name or IP address to connect to.
port - the port on the target host to connect to.
streaming - if true a streaming socket is returned, a datagram socket otherwise.
Throws:
UnknownHostException - if the host name could not be resolved into an IP address.
IOException - if an error occurs while creating the socket.
SecurityException - if a security manager exists and it denies the permission to connect to the given address and port.
Since:
Android 1.0

Socket

public Socket(InetAddress dstAddress,
              int dstPort)
       throws IOException
Creates a new streaming socket connected to the target host specified by the parameters dstAddress and dstPort. The socket is bound to any available port on the local host.

Parameters:
dstAddress - the target host address to connect to.
dstPort - the port on the target host to connect to.
Throws:
IOException - if an error occurs while creating the socket.
SecurityException - if a security manager exists and it denies the permission to connect to the given address and port.
Since:
Android 1.0

Socket

public Socket(InetAddress dstAddress,
              int dstPort,
              InetAddress localAddress,
              int localPort)
       throws IOException
Creates a new streaming socket connected to the target host specified by the parameters dstAddress and dstPort. On the local endpoint the socket is bound to the given address localAddress on port localPort.

Parameters:
dstAddress - the target host address to connect to.
dstPort - the port on the target host to connect to.
localAddress - the address on the local host to bind to.
localPort - the port on the local host to bind to.
Throws:
IOException - if an error occurs while creating the socket.
SecurityException - if a security manager exists and it denies the permission to connect to the given address and port.
Since:
Android 1.0

Socket

@Deprecated
public Socket(InetAddress addr,
                         int port,
                         boolean streaming)
       throws IOException
Deprecated. Use Socket(InetAddress, int) instead of this for streaming sockets or an appropriate constructor of DatagramSocket for UDP transport.

Creates a new streaming or datagram socket connected to the target host specified by the parameters addr and port. The socket is bound to any available port on the local host.

Parameters:
addr - the Internet address to connect to.
port - the port on the target host to connect to.
streaming - if true a streaming socket is returned, a datagram socket otherwise.
Throws:
IOException - if an error occurs while creating the socket.
SecurityException - if a security manager exists and it denies the permission to connect to the given address and port.
Since:
Android 1.0

Socket

protected Socket(SocketImpl anImpl)
          throws SocketException
Creates an unconnected socket with the given socket implementation.

Parameters:
anImpl - the socket implementation to be used.
Throws:
SocketException - if an error occurs while creating the socket.
Since:
Android 1.0
Method Detail

checkDestination

void checkDestination(InetAddress destAddr,
                      int dstPort)
Checks whether the connection destination satisfies the security policy and the validity of the port range.

Parameters:
destAddr - the destination host address.
dstPort - the port on the destination host.

close

public void close()
           throws IOException
Closes the socket. It is not possible to reconnect or rebind to this socket thereafter which means a new socket instance has to be created.

Throws:
IOException - if an error occurs while closing the socket.
Since:
Android 1.0

getInetAddress

public InetAddress getInetAddress()
Gets the IP address of the target host this socket is connected to.

Returns:
the IP address of the connected target host or null if this socket is not yet connected.
Since:
Android 1.0

getInputStream

public InputStream getInputStream()
                           throws IOException
Gets an input stream to read data from this socket.

Returns:
the byte-oriented input stream.
Throws:
IOException - if an error occurs while creating the input stream or the socket is in an invalid state.
Since:
Android 1.0

getKeepAlive

public boolean getKeepAlive()
                     throws SocketException
Gets the setting of the socket option SocketOptions.SO_KEEPALIVE.

Returns:
true if the SocketOptions.SO_KEEPALIVE is enabled, false otherwise.
Throws:
SocketException - if an error occurs while reading the socket option.
Since:
Android 1.0
See Also:
SocketOptions.SO_KEEPALIVE

getLocalAddress

public InetAddress getLocalAddress()
Gets the local IP address this socket is bound to.

Returns:
the local IP address of this socket or InetAddress.ANY if the socket is unbound.
Since:
Android 1.0

getLocalPort

public int getLocalPort()
Gets the local port this socket is bound to.

Returns:
the local port of this socket or -1 if the socket is unbound.
Since:
Android 1.0

getOutputStream

public OutputStream getOutputStream()
                             throws IOException
Gets an output stream to write data into this socket.

Returns:
the byte-oriented output stream.
Throws:
IOException - if an error occurs while creating the output stream or the socket is in an invalid state.
Since:
Android 1.0

getPort

public int getPort()
Gets the port number of the target host this socket is connected to.

Returns:
the port number of the connected target host or 0 if this socket is not yet connected.
Since:
Android 1.0

getSoLinger

public int getSoLinger()
                throws SocketException
Gets the value of the socket option SocketOptions.SO_LINGER.

Returns:
the current value of the option SocketOptions.SO_LINGER or -1 if this option is disabled.
Throws:
SocketException - if an error occurs while reading the socket option.
Since:
Android 1.0
See Also:
SocketOptions.SO_LINGER

getReceiveBufferSize

public int getReceiveBufferSize()
                         throws SocketException
Gets the receive buffer size of this socket.

Returns:
the current value of the option SocketOptions.SO_RCVBUF.
Throws:
SocketException - if an error occurs while reading the socket option.
Since:
Android 1.0
See Also:
SocketOptions.SO_RCVBUF

getSendBufferSize

public int getSendBufferSize()
                      throws SocketException
Gets the send buffer size of this socket.

Returns:
the current value of the option SocketOptions.SO_SNDBUF.
Throws:
SocketException - if an error occurs while reading the socket option.
Since:
Android 1.0
See Also:
SocketOptions.SO_SNDBUF

getSoTimeout

public int getSoTimeout()
                 throws SocketException
Gets the timeout for this socket during which a reading operation shall block while waiting for data.

Returns:
the current value of the option SocketOptions.SO_TIMEOUT or 0 which represents an infinite timeout.
Throws:
SocketException - if an error occurs while reading the socket option.
Since:
Android 1.0
See Also:
SocketOptions.SO_TIMEOUT

getTcpNoDelay

public boolean getTcpNoDelay()
                      throws SocketException
Gets the setting of the socket option SocketOptions.TCP_NODELAY.

Returns:
true if the SocketOptions.TCP_NODELAY is enabled, false otherwise.
Throws:
SocketException - if an error occurs while reading the socket option.
Since:
Android 1.0
See Also:
SocketOptions.TCP_NODELAY

setKeepAlive

public void setKeepAlive(boolean value)
                  throws SocketException
Sets the state of the SocketOptions.SO_KEEPALIVE for this socket.

Parameters:
value - the state whether this option is enabled or not.
Throws:
SocketException - if an error occurs while setting the option.
Since:
Android 1.0
See Also:
SocketOptions.SO_KEEPALIVE

setSocketImplFactory

public static void setSocketImplFactory(SocketImplFactory fac)
                                 throws IOException
Sets the internal factory for creating socket implementations. This may only be executed once during the lifetime of the application.

Parameters:
fac - the socket implementation factory to be set.
Throws:
IOException - if the factory has been already set.
Since:
Android 1.0

setSendBufferSize

public void setSendBufferSize(int size)
                       throws SocketException
Sets the send buffer size of this socket.

Parameters:
size - the buffer size in bytes. This value must be a positive number greater than 0.
Throws:
SocketException - if an error occurs while setting the size or the given value is an invalid size.
Since:
Android 1.0
See Also:
SocketOptions.SO_SNDBUF

setReceiveBufferSize

public void setReceiveBufferSize(int size)
                          throws SocketException
Sets the receive buffer size of this socket.

Parameters:
size - the buffer size in bytes. This value must be a positive number greater than 0.
Throws:
SocketException - if an error occurs while setting the size or the given value is an invalid size.
Since:
Android 1.0
See Also:
SocketOptions.SO_RCVBUF

setSoLinger

public void setSoLinger(boolean on,
                        int timeout)
                 throws SocketException
Sets the state of the SocketOptions.SO_LINGER with the given timeout in seconds. The timeout value for this option is silently limited to the maximum of 65535.

Parameters:
on - the state whether this option is enabled or not.
timeout - the linger timeout value in seconds.
Throws:
SocketException - if an error occurs while setting the option.
Since:
Android 1.0
See Also:
SocketOptions.SO_LINGER

setSoTimeout

public void setSoTimeout(int timeout)
                  throws SocketException
Sets the reading timeout in milliseconds for this socket. The read operation will block indefinitely if this option value is set to 0. The timeout must be set before calling the read operation. A SocketTimeoutException is thrown when this timeout expires.

Parameters:
timeout - the reading timeout value as number greater than 0 or 0 for an infinite timeout.
Throws:
SocketException - if an error occurs while setting the option.
Since:
Android 1.0
See Also:
SocketOptions.SO_TIMEOUT

setTcpNoDelay

public void setTcpNoDelay(boolean on)
                   throws SocketException
Sets the state of the SocketOptions.TCP_NODELAY for this socket.

Parameters:
on - the state whether this option is enabled or not.
Throws:
SocketException - if an error occurs while setting the option.
Since:
Android 1.0
See Also:
SocketOptions.TCP_NODELAY

startupSocket

void startupSocket(InetAddress dstAddress,
                   int dstPort,
                   InetAddress localAddress,
                   int localPort,
                   boolean streaming)
             throws IOException
Creates a stream socket, binds it to the nominated local address/port, then connects it to the nominated destination address/port.

Parameters:
dstAddress - the destination host address.
dstPort - the port on the destination host.
localAddress - the address on the local machine to bind.
localPort - the port on the local machine to bind.
Throws:
IOException - thrown if an error occurs during the bind or connect operations.

toString

public String toString()
Returns a String containing a concise, human-readable description of the socket.

Overrides:
toString in class Object
Returns:
the textual representation of this socket.
Since:
Android 1.0

shutdownInput

public void shutdownInput()
                   throws IOException
Closes the input stream of this socket. Any further data sent to this socket will be discarded. Reading from this socket after this method has been called will return the value EOF.

Throws:
IOException - if an error occurs while closing the socket input stream.
SocketException - if the input stream is already closed.
Since:
Android 1.0

shutdownOutput

public void shutdownOutput()
                    throws IOException
Closes the output stream of this socket. All buffered data will be sent followed by the termination sequence. Writing to the closed output stream will cause an IOException.

Throws:
IOException - if an error occurs while closing the socket output stream.
SocketException - if the output stream is already closed.
Since:
Android 1.0

getLocalSocketAddress

public SocketAddress getLocalSocketAddress()
Gets the local address and port of this socket as a SocketAddress or null if the socket is unbound. This is useful on multihomed hosts.

Returns:
the bound local socket address and port.
Since:
Android 1.0

getRemoteSocketAddress

public SocketAddress getRemoteSocketAddress()
Gets the remote address and port of this socket as a SocketAddress or null if the socket is not connected.

Returns:
the remote socket address and port.
Since:
Android 1.0

isBound

public boolean isBound()
Returns whether this socket is bound to a local address and port.

Returns:
true if the socket is bound to a local address, false otherwise.
Since:
Android 1.0

isConnected

public boolean isConnected()
Returns whether this socket is connected to a remote host.

Returns:
true if the socket is connected, false otherwise.
Since:
Android 1.0

isClosed

public boolean isClosed()
Returns whether this socket is closed.

Returns:
true if the socket is closed, false otherwise.
Since:
Android 1.0

bind

public void bind(SocketAddress localAddr)
          throws IOException
Binds this socket to the given local host address and port specified by the SocketAddress localAddr. If localAddr is set to null, this socket will be bound to an available local address on any free port.

Parameters:
localAddr - the specific address and port on the local machine to bind to.
Throws:
IllegalArgumentException - if the given SocketAddress is invalid or not supported.
IOException - if the socket is already bound or an error occurs while binding.
Since:
Android 1.0

connect

public void connect(SocketAddress remoteAddr)
             throws IOException
Connects this socket to the given remote host address and port specified by the SocketAddress remoteAddr.

Parameters:
remoteAddr - the address and port of the remote host to connect to.
Throws:
IllegalArgumentException - if the given SocketAddress is invalid or not supported.
IOException - if the socket is already connected or an error occurs while connecting.
Since:
Android 1.0

connect

public void connect(SocketAddress remoteAddr,
                    int timeout)
             throws IOException
Connects this socket to the given remote host address and port specified by the SocketAddress remoteAddr with the specified timeout. The connecting method will block until the connection is established or an error occurred.

Parameters:
remoteAddr - the address and port of the remote host to connect to.
timeout - the timeout value in milliseconds or 0 for an infinite timeout.
Throws:
IllegalArgumentException - if the given SocketAddress is invalid or not supported or the timeout value is negative.
IOException - if the socket is already connected or an error occurs while connecting.
Since:
Android 1.0

isInputShutdown

public boolean isInputShutdown()
Returns whether the incoming channel of the socket has already been closed.

Returns:
true if reading from this socket is not possible anymore, false otherwise.
Since:
Android 1.0

isOutputShutdown

public boolean isOutputShutdown()
Returns whether the outgoing channel of the socket has already been closed.

Returns:
true if writing to this socket is not possible anymore, false otherwise.
Since:
Android 1.0

setReuseAddress

public void setReuseAddress(boolean reuse)
                     throws SocketException
Sets the state of the SocketOptions.SO_REUSEADDR for this socket.

Parameters:
reuse - the state whether this option is enabled or not.
Throws:
SocketException - if an error occurs while setting the option.
Since:
Android 1.0
See Also:
SocketOptions.SO_REUSEADDR

getReuseAddress

public boolean getReuseAddress()
                        throws SocketException
Gets the setting of the socket option SocketOptions.SO_REUSEADDR.

Returns:
true if the SocketOptions.SO_REUSEADDR is enabled, false otherwise.
Throws:
SocketException - if an error occurs while reading the socket option.
Since:
Android 1.0
See Also:
SocketOptions.SO_REUSEADDR

setOOBInline

public void setOOBInline(boolean oobinline)
                  throws SocketException
Sets the state of the SocketOptions.SO_OOBINLINE for this socket. When this option is enabled urgent data can be received in-line with normal data.

Parameters:
oobinline - whether this option is enabled or not.
Throws:
SocketException - if an error occurs while setting the option.
Since:
Android 1.0
See Also:
SocketOptions.SO_OOBINLINE

getOOBInline

public boolean getOOBInline()
                     throws SocketException
Gets the setting of the socket option SocketOptions.SO_OOBINLINE.

Returns:
true if the SocketOptions.SO_OOBINLINE is enabled, false otherwise.
Throws:
SocketException - if an error occurs while reading the socket option.
Since:
Android 1.0
See Also:
SocketOptions.SO_OOBINLINE

setTrafficClass

public void setTrafficClass(int value)
                     throws SocketException
Sets the value of the SocketOptions.IP_TOS for this socket. See the specification RFC 1349 for more information about the type of service field.

Parameters:
value - the value to be set for this option with a valid range of 0-255.
Throws:
SocketException - if an error occurs while setting the option.
Since:
Android 1.0
See Also:
SocketOptions.IP_TOS

getTrafficClass

public int getTrafficClass()
                    throws SocketException
Gets the value of the socket option SocketOptions.IP_TOS.

Returns:
the value which represents the type of service.
Throws:
SocketException - if an error occurs while reading the socket option.
Since:
Android 1.0
See Also:
SocketOptions.IP_TOS

sendUrgentData

public void sendUrgentData(int value)
                    throws IOException
Sends the given single byte data which is represented by the lowest octet of value as "TCP urgent data".

Parameters:
value - the byte of urgent data to be sent.
Throws:
IOException - if an error occurs while sending urgent data.
Since:
Android 1.0

accepted

void accepted()
Set the appropriate flags for a socket created by ServerSocket.accept().

See Also:
ServerSocket.implAccept(java.net.Socket)

preferIPv4Stack

static boolean preferIPv4Stack()

getChannel

public SocketChannel getChannel()
Gets the SocketChannel of this socket, if one is available. The current implementation of this method returns always null.

Returns:
the related SocketChannel or null if no channel exists.
Since:
Android 1.0

setPerformancePreferences

public void setPerformancePreferences(int connectionTime,
                                      int latency,
                                      int bandwidth)
Sets performance preferences for connectionTime, latency and bandwidth.

This method does currently nothing.

Parameters:
connectionTime - the value representing the importance of a short connecting time.
latency - the value representing the importance of low latency.
bandwidth - the value representing the importance of high bandwidth.
Since:
Android 1.0

Build 1.1_r1 (from source)

Please submit a feedback, bug or feature