com.msi.network.connection
Class TCPInterface

java.lang.Object
  extended bycom.msi.network.connection.TCPInterface
All Implemented Interfaces:
ConnectionConstants, ServiceInterface

public class TCPInterface
extends java.lang.Object
implements ServiceInterface, ConnectionConstants

A ServiceInterface support the TCP/IP protocol.

Version:
1.0
Author:
Ken Thompson

Field Summary
private  int backlog
           
private  long connTO
           
private  boolean isSSL
           
private  int maxConnections
           
private  int openConnections
           
private  int port
           
private  java.net.ServerSocket sock
           
 
Fields inherited from interface com.msi.network.connection.ServiceInterface
TCP, UDP
 
Fields inherited from interface com.msi.network.connection.ConnectionConstants
defaultBacklog, defaultMaxConnections
 
Constructor Summary
private TCPInterface()
           
  TCPInterface(int port, int maxConnections)
          TCPInterface -
  TCPInterface(int port, int maxConnections, boolean isSSL)
          Creates a new TCPInterface instance.
  TCPInterface(int port, int maxConnections, long cTO)
          TCPInterface -
  TCPInterface(int port, int maxConnections, long cTO, boolean isSSL)
          Creates a new TCPInterface instance.
 
Method Summary
 void close()
          close -
 void connectionClosed()
          closeConnection - close the previously allocated connection, adjusting the number of openConnections accordingly.
 int getBacklog()
          Get the value of backlog.
 Connection getConnection()
          getConnection -
 long getConnTO()
          Get the value of connTO.
 int getMaxConnections()
          Gets the value of maxConnections
 int getOpenConnections()
          Gets the value of openConnections
 int getPort()
          Gets the value of port
 java.net.ServerSocket getSock()
          Gets the value of sock
 boolean isIsSSL()
          Get the value of isSSL.
private  java.net.ServerSocket makeServerSocket(int port, int backlog, boolean isSSL)
           
 void setBacklog(int v)
          Set the value of backlog.
 void setConnTO(long v)
          Set the value of connTO.
 void setIsSSL(boolean v)
          Set the value of isSSL.
 void setMaxConnections(int argMaxConnections)
          Sets the value of maxConnections
 void setOpenConnections(int argOpenConnections)
          Sets the value of openConnections
 void setPort(int argPort)
          Sets the value of port
 void setSock(java.net.ServerSocket argSock)
          Sets the value of sock
 java.lang.String statsString()
          statsString - present the current state as a String.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

isSSL

private boolean isSSL

backlog

private int backlog

port

private int port

sock

private java.net.ServerSocket sock

openConnections

private int openConnections

maxConnections

private int maxConnections

connTO

private long connTO
Constructor Detail

TCPInterface

private TCPInterface()

TCPInterface

public TCPInterface(int port,
                    int maxConnections)
TCPInterface -

Parameters:
port - an int value
maxConnections - an int value

TCPInterface

public TCPInterface(int port,
                    int maxConnections,
                    boolean isSSL)
Creates a new TCPInterface instance.

Parameters:
port - an int value
maxConnections - an int value
isSSL - a boolean value

TCPInterface

public TCPInterface(int port,
                    int maxConnections,
                    long cTO)
TCPInterface -

Parameters:
port - an int value
maxConnections - an int value
cTO - a long value

TCPInterface

public TCPInterface(int port,
                    int maxConnections,
                    long cTO,
                    boolean isSSL)
Creates a new TCPInterface instance.

Parameters:
port - an int value
maxConnections - an int value
cTO - a long value
isSSL - a boolean value
Method Detail

makeServerSocket

private java.net.ServerSocket makeServerSocket(int port,
                                               int backlog,
                                               boolean isSSL)
                                        throws java.lang.Exception
Throws:
java.lang.Exception

getConnection

public Connection getConnection()
getConnection -

Specified by:
getConnection in interface ServiceInterface
Returns:
a Connection value

connectionClosed

public void connectionClosed()
closeConnection - close the previously allocated connection, adjusting the number of openConnections accordingly.


close

public void close()
close -

Specified by:
close in interface ServiceInterface

statsString

public java.lang.String statsString()
statsString - present the current state as a String.

Returns:
String representation of interface state.

getBacklog

public int getBacklog()
Get the value of backlog. Backlog is the maximum number of clients the socket will hold in queue before it begins denying new requests.

Returns:
value of backlog.

setBacklog

public void setBacklog(int v)
Set the value of backlog. Backlog is the maximum number of clients the socket will hold in queue before it begins denying new requests.

Parameters:
v - Value to assign to backlog.

getPort

public int getPort()
Gets the value of port

Returns:
the value of port

setPort

public void setPort(int argPort)
Sets the value of port

Parameters:
argPort - Value to assign to this.port

getSock

public java.net.ServerSocket getSock()
Gets the value of sock

Returns:
the value of sock

setSock

public void setSock(java.net.ServerSocket argSock)
Sets the value of sock

Parameters:
argSock - Value to assign to this.sock

getOpenConnections

public int getOpenConnections()
Gets the value of openConnections

Returns:
the value of openConnections

setOpenConnections

public void setOpenConnections(int argOpenConnections)
Sets the value of openConnections

Parameters:
argOpenConnections - Value to assign to this.openConnections

getMaxConnections

public int getMaxConnections()
Gets the value of maxConnections

Returns:
the value of maxConnections

setMaxConnections

public void setMaxConnections(int argMaxConnections)
Sets the value of maxConnections

Parameters:
argMaxConnections - Value to assign to this.maxConnections

getConnTO

public long getConnTO()
Get the value of connTO.

Returns:
value of connTO.

setConnTO

public void setConnTO(long v)
Set the value of connTO.

Parameters:
v - Value to assign to connTO.

isIsSSL

public boolean isIsSSL()
Get the value of isSSL.

Returns:
value of isSSL.

setIsSSL

public void setIsSSL(boolean v)
Set the value of isSSL.

Parameters:
v - Value to assign to isSSL.


Copyright © 2001-2002 MileStone Solutions, Inc. All Rights Reserved.