| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjist.swans.trans.TcpServerSocket
public class TcpServerSocket
SWANS Implementation of Server Socket entity.
| Nested Class Summary | |
|---|---|
| static class | TcpServerSocket.TcpServerSocketCallbackImplementation of Socket Callback for TcpServerSocket. | 
| Nested classes/interfaces inherited from interface jist.swans.trans.SocketInterface | 
|---|
| SocketInterface.TcpServerSocketInterface, SocketInterface.TcpSocketInterface | 
| Constructor Summary | |
|---|---|
| TcpServerSocket()Creates an unbound server socket. | |
| TcpServerSocket(int port)Creates a server socket, bound to the specified port. | |
| TcpServerSocket(int port,
                int backlog)Creates a server socket and binds it to the specified local port number, with the specified backlog. | |
| TcpServerSocket(int port,
                int backlog,
                java.net.InetAddress bindAddr)Creates a server with the specified port, listen backlog, and local IP address to bind to. | |
| Method Summary | |
|---|---|
|  void | _jistPostInit()Post-constructor call. | 
|  TcpSocket | accept()Listens for a connection to be made to this socket and accepts it. | 
|  void | bind(java.net.SocketAddress bindpoint)Binds the ServerSocket to a specific address (IP address and port number). | 
|  void | bind(java.net.SocketAddress endpoint,
     int backlog)Binds the ServerSocket to a specific address (IP address and port number). | 
|  void | checkPacketandState(TransTcp.TcpMessage msg,
                    NetAddress src)Check and process the incoming packet depending on current state of the socket. | 
|  void | close()Closes this socket. | 
|  void | createProxy()Create an entity reference to itself. | 
|  java.nio.channels.ServerSocketChannel | getChannel()Returns the unique ServerSocketChannel object associated with this socket, if any. | 
|  java.net.InetAddress | getInetAddress()Returns the local address of this server socket/socket. | 
|  int | getLocalPort()Returns the port on which this socket is listening. | 
|  java.net.SocketAddress | getLocalSocketAddress()Returns the address of the endpoint this socket is bound to, or null if it is not bound yet. | 
|  SocketInterface.TcpServerSocketInterface | getProxy()Returns the entity reference to the server socket itself. | 
| static int | getRandomSequenceNumber()Method to get a random sequence number. | 
|  int | getReceiveBufferSize()Gets the value of the SO_RCVBUF option for this ServerSocket, that is the proposed buffer size that will be used for Sockets accepted from this ServerSocket. | 
|  boolean | getReuseAddress()Tests if SO_REUSEADDR is enabled. | 
|  int | getSoTimeout()Retrieve setting for SO_TIMEOUT. | 
| protected  void | implAccept(java.net.Socket s)Subclasses of ServerSocket use this method to override accept() to return their own subclass of socket. | 
|  boolean | isBound()Returns the binding state of the ServerSocket. | 
|  boolean | isClosed()Returns the closed state of the ServerSocket. | 
|  void | setReceiveBufferSize(int size)Sets a default proposed value for the SO_RCVBUF option for sockets accepted from this ServerSocket. | 
|  void | setReuseAddress(boolean on)Enable/disable the SO_REUSEADDR socket option. | 
| static void | setSocketFactory(java.net.SocketImplFactory fac)Sets the server socket implementation factory for the application. | 
|  void | setSoTimeout(int timeout)Enable/disable SO_TIMEOUT with the specified timeout, in milliseconds. | 
|  void | setTcpEntity(TransInterface.TransTcpInterface tcpEntity)Sets the reference to the network layer. | 
|  java.lang.String | toString()Returns the implementation address and implementation port of this socket as a String. | 
| Methods inherited from class java.lang.Object | 
|---|
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait | 
| Constructor Detail | 
|---|
public TcpServerSocket()
public TcpServerSocket(int port)
port - the port number, or 0 to use any free port.
public TcpServerSocket(int port,
                       int backlog)
port - the specified port, or 0 to use any free port.backlog - the maximum length of the queue.
public TcpServerSocket(int port,
                       int backlog,
                       java.net.InetAddress bindAddr)
port - the local TCP portbacklog - the listen backlogbindAddr - the local InetAddress the server will bind to| Method Detail | 
|---|
public void createProxy()
public SocketInterface.TcpServerSocketInterface getProxy()
public void setTcpEntity(TransInterface.TransTcpInterface tcpEntity)
setTcpEntity in interface SocketInterfacetcpEntity - entity reference to transport layerpublic void _jistPostInit()
_jistPostInit in interface SocketInterfacepublic TcpSocket accept()
accept in interface SocketInterface.TcpServerSocketInterfacepublic void bind(java.net.SocketAddress bindpoint)
bind in interface SocketInterfacebindpoint - The IP address & port number to bind to.
public void bind(java.net.SocketAddress endpoint,
                 int backlog)
bind in interface SocketInterface.TcpServerSocketInterfaceendpoint - The IP address & port number to bind to.backlog - The listen backlog length.public void close()
close in interface SocketInterfacepublic java.nio.channels.ServerSocketChannel getChannel()
getChannel in interface SocketInterface.TcpServerSocketInterfacepublic java.net.InetAddress getInetAddress()
getInetAddress in interface SocketInterfacepublic int getLocalPort()
getLocalPort in interface SocketInterfacepublic java.net.SocketAddress getLocalSocketAddress()
getLocalSocketAddress in interface SocketInterfacepublic int getReceiveBufferSize()
getReceiveBufferSize in interface SocketInterfacepublic boolean getReuseAddress()
getReuseAddress in interface SocketInterfacepublic int getSoTimeout()
getSoTimeout in interface SocketInterfaceprotected void implAccept(java.net.Socket s)
s - the Socketpublic boolean isBound()
isBound in interface SocketInterfacepublic boolean isClosed()
isClosed in interface SocketInterfacepublic void setReceiveBufferSize(int size)
setReceiveBufferSize in interface SocketInterfacesize - the size to which to set the receive buffer size. 
 This value must be greater than 0.public void setReuseAddress(boolean on)
setReuseAddress in interface SocketInterfaceon - whether to enable or disable the socket optionpublic static void setSocketFactory(java.net.SocketImplFactory fac)
fac - the desired factory.public void setSoTimeout(int timeout)
setSoTimeout in interface SocketInterfacetimeout - the specified timeout, in millisecondspublic java.lang.String toString()
toString in interface SocketInterfacetoString in class java.lang.Object
public void checkPacketandState(TransTcp.TcpMessage msg,
                                NetAddress src)
checkPacketandState in interface SocketInterfacemsg - the incoming TCP messagesrc - source of packetpublic static int getRandomSequenceNumber()
| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||