|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--amber.client.SocketConnection
This class implements the ConnectionModule interface. It handles the requirements for managing a standard socket connection to the remote server. If the parameters for this module are not set then the default fail overs are used.
This details the parameters and their values.
| Name | Type | Description | Default |
|---|---|---|---|
| SECURE | boolean | Whether the connection should be secured (encrypted). | 0 (false) |
| SERVERSHA | int | The SHA-1 digest of the RSA values held at the server. This is to avoid man-in-the-middle attacks of the secure connection. | No default, no check on RSA validity is performed. |
| SERVER | String | The IP address of the Amber server. | The IP address of the server which served the Web page. |
| PORT | int | The port number to connect to at the remote server. | 21384 if not sercure or 21385 if secure. |
ConnectionModule,
BaseComponent| Field Summary | |
protected int |
clientType
|
protected BaseComponent |
parent
|
protected java.lang.String |
serverName
The address of the Amber Server. |
protected int |
serverPort
The port the Amber Server is listening on. |
protected java.lang.String |
sessionId
|
protected java.net.Socket |
socket
|
| Constructor Summary | |
SocketConnection()
Default constructor. |
|
| Method Summary | |
void |
close()
Closes the connection to the remote server. |
void |
commLinkLost()
This function is called when the system has detected a communications fault to the server. |
void |
forwardPacket(Packet packet)
Called by the ReceiveThread and any internal functions when a packet is to be sent to its required destination. |
void |
init(BaseComponent parent,
Packet initialPacket,
int clientType,
java.lang.Object configuration)
This function initialises the connection module and establishes a link to the Amber server. |
void |
run()
This function is a one-shot routine which is concerned with establishing a connection to the server. |
void |
sendPacket(Packet packet)
Sends a packet to the remote server. |
void |
setSessionId(java.lang.String sessionId)
Sets the internal session identifier which is used when the connection is reestablished. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected BaseComponent parent
protected java.lang.String sessionId
protected java.net.Socket socket
protected java.lang.String serverName
protected int serverPort
protected int clientType
| Constructor Detail |
public SocketConnection()
| Method Detail |
public void init(BaseComponent parent,
Packet initialPacket,
int clientType,
java.lang.Object configuration)
throws java.io.IOException
init in interface ConnectionModuleinitialPacket - to send to the server.clientType - int type of client object connecting.configuration - Object containing optional configuration information.
If this object is null the module will query the parent using getParameter
to get the required information.java.io.IOException - with any connection problems.public void setSessionId(java.lang.String sessionId)
setSessionId in interface ConnectionModulesessionId - String containing the session identifier.public void sendPacket(Packet packet)
sendPacket in interface ConnectionModulepacket - Packet to send to the server.
public void forwardPacket(Packet packet)
throws AmberException
forwardPacket in interface ConnectionModulepacket - Packet containing the information to send to the specified
component.AmberException - containing any errors.public void close()
close in interface ConnectionModulepublic void commLinkLost()
commLinkLost in interface ConnectionModulepublic void run()
run in interface java.lang.Runnable
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||