org.mbari.siam.utils
Class TimeoutServerSocket

java.lang.Object
  extended by java.net.ServerSocket
      extended by org.mbari.siam.utils.TimeoutServerSocket

public class TimeoutServerSocket
extends java.net.ServerSocket

TimeoutServerSocket overrides ServerSocket's accept() method; it sets soTimeout on the returned socket.

Author:
Tom O'Reilly

Constructor Summary
TimeoutServerSocket(int port)
           
TimeoutServerSocket(int port, int backlog)
           
TimeoutServerSocket(int port, int backlog, java.net.InetAddress bindAddr)
           
TimeoutServerSocket(int port, int backlog, int timeout)
          Constructor with timeout
 
Method Summary
 java.net.Socket accept()
          Accept a connection and set timeout on its socket.
static void setDefaultTimeout(int timeout)
          Set default timeout.
 
Methods inherited from class java.net.ServerSocket
bind, bind, close, getChannel, getInetAddress, getLocalPort, getLocalSocketAddress, getReceiveBufferSize, getReuseAddress, getSoTimeout, implAccept, isBound, isClosed, setPerformancePreferences, setReceiveBufferSize, setReuseAddress, setSocketFactory, setSoTimeout, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TimeoutServerSocket

public TimeoutServerSocket(int port,
                           int backlog,
                           int timeout)
                    throws java.io.IOException
Constructor with timeout

Throws:
java.io.IOException

TimeoutServerSocket

public TimeoutServerSocket(int port)
                    throws java.io.IOException
Throws:
java.io.IOException

TimeoutServerSocket

public TimeoutServerSocket(int port,
                           int backlog)
                    throws java.io.IOException
Throws:
java.io.IOException

TimeoutServerSocket

public TimeoutServerSocket(int port,
                           int backlog,
                           java.net.InetAddress bindAddr)
                    throws java.io.IOException
Throws:
java.io.IOException
Method Detail

setDefaultTimeout

public static void setDefaultTimeout(int timeout)
Set default timeout. This is the timeout that applies to the Socket that's returned via accept(), not the ServerSocket itself


accept

public java.net.Socket accept()
                       throws java.io.IOException
Accept a connection and set timeout on its socket.

Overrides:
accept in class java.net.ServerSocket
Throws:
java.io.IOException


Copyright © 2003 MBARI.

The Monterey Bay Aquarium Research Institute (MBARI) provides this documentation and code "as is", with no warranty, express or implied, of its quality or consistency. It is provided without support and without obligation on the part of MBARI to assist in its use, correction, modification, or enhancement.