SecurePlayLibray J2SE
v2.1

com.SecurePlay.Comms.SPCcommsTCP
Class SocketConnectionTCP

java.lang.Object
  extended bycom.SecurePlay.Comms.SPCcommsTCP.SocketConnectionTCP

public class SocketConnectionTCP
extends java.lang.Object

This class represents a connection. It also spawns a listener class in a seperate thread that listens incoming messages. It is also used to send messages out. The reason for this class existence is that a connection can be stored in a map and grabbed to send messages whenever, while the listener it spawned listens to messages.

Author:
IT GlobalSecure
See Also:
SecurePlay License Information
 

Field Summary
(package private)  java.net.Socket client
          This is the socket connection.
(package private)  java.io.OutputStream out
          This is the output stream to the socket connection.
(package private)  SPCcommsTCP tcpMain
          This is the main TCP driver class that this connection is associated to.
 
Constructor Summary
SocketConnectionTCP(java.net.InetAddress address, int port, SPCcommsTCP m)
          Constructor is used when a connection needs to be created through a certain port.
SocketConnectionTCP(java.net.Socket s, SPCcommsTCP m)
          Constructor is used when a SocketServer recieves a connection and passes the socket to this class.
 
Method Summary
 boolean closeConnection()
          This method closes the connection and kills the thread that listens to incoming messages.
 void incoming(byte[] mess)
          Passes incoming messages from listener to the main driver.
 void write(byte[] data)
          This method writes messages to the connection.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

tcpMain

SPCcommsTCP tcpMain
This is the main TCP driver class that this connection is associated to.


client

java.net.Socket client
This is the socket connection.


out

java.io.OutputStream out
This is the output stream to the socket connection.

Constructor Detail

SocketConnectionTCP

public SocketConnectionTCP(java.net.Socket s,
                           SPCcommsTCP m)
                    throws java.io.IOException
Constructor is used when a SocketServer recieves a connection and passes the socket to this class.

Throws:
java.io.IOException
Parameters:
s - Socket - connection recieved.
m - SPCcommsTCP - TCP comms driver class that this connection associated to.

SocketConnectionTCP

public SocketConnectionTCP(java.net.InetAddress address,
                           int port,
                           SPCcommsTCP m)
                    throws java.io.IOException
Constructor is used when a connection needs to be created through a certain port.

Throws:
java.io.IOException
Parameters:
address - InetAddress - address of the connection.
port - int - port number that the connection is created.
m - SPCcommsTCP - TCP comms driver class that this connection associated to.
Method Detail

incoming

public void incoming(byte[] mess)
Passes incoming messages from listener to the main driver.

Parameters:
mess - byte[] - incoming message to be processed

write

public void write(byte[] data)
           throws java.io.IOException
This method writes messages to the connection.

Throws:
java.io.IOException
Parameters:
data - byte[] - messages to be written.

closeConnection

public boolean closeConnection()
This method closes the connection and kills the thread that listens to incoming messages.

Throws:
java.io.IOException

SecurePlayLibray J2SE
v2.1

2006 Copyright Filed by IT GlobalSecure, Inc. All Rights Reserved. Not to be used without authorization by Author. SecurePlay, IT GlobalSecure, and IT Armor are registered trademarks by IT GlobalSecure, Inc. Software protected by software license, and one or more the following U.S. and International patent numbers: U.S. Patent 6,030,288, U.S. Patent 6,165,072, European Patent Office EP1016049A1,and World Intellectual Property Organization WO9912135C1 and additional filings worldwide.