All Packages Class Hierarchy This Package Previous Next Index
Class ProtocolLayer.FTPConnectorThread
ProtocolLayer.ConnectorThread
|
+----ProtocolLayer.FTPConnectorThread
- public class FTPConnectorThread
- extends ConnectorThread
ConnectorThread which takes a role to make a server socket for applet data transfer.
When an applet wants data transfer using FTP protocol, FTPConnectorThread will be created
to connect the applet and a FTP server. This connector will create one ServerSocket
for each FTP 'PORT' operation. From the agent perspective, it will use
pre-existing FTP.
-
FTPConnectorThread(Address, int, int)
- Constructor using FTP server address.
-
FTPConnectorThread(Socket, int, int)
- Constructor with internet service server address, priority and maximum idle time.
-
closePortConnector()
- Close port connector
-
createFTPPortThread()
- Create FTP PORT thread to process data
FTPPortThread will create two server socket, one for server side and one for applet side.
-
dataTransfer(boolean)
- Data transfer transaction.
-
disconnectCon()
- Will be invoked by timer, if time out reached.
-
run()
- Starts to accept socket connection from an applet.
-
sendMessageToClient(String)
- Send a message to applet side
-
sendMessageToServer(String)
- Send a message to server side
FTPConnectorThread
public FTPConnectorThread(Address serverAddress,
int priority,
int connectionWaitTime) throws ConnectionException
- Constructor using FTP server address.
- Parameters:
- serverAddress - FTP server address
- priority - Thread priority
- connectionWaitTime - Maximum idle time
FTPConnectorThread
public FTPConnectorThread(Socket toSocket,
int priority,
int connectionWaitTime) throws ConnectionException
- Constructor with internet service server address, priority and maximum idle time.
Router will try to connect to given service address.
- Parameters:
- toSocket - Internet service server socket.
- priority - Thread priority
- connectionWaitTime - Maximum idle time.
- Throws: ConnectionException
- If server connection is failed, or
fails to create ServerSocket for an applet.
run
public void run()
- Starts to accept socket connection from an applet. Afer accepting the connection,
Receiver thread to receive messages from the applet will be created and started.
ServerSocket opened for accepting the connection will be closed. Then, receiving/sending
messages from both sides will be performed until "QUIT" message is received from
the applet side. If the applet has no chance to send 'QUIT' message to router,
this thread will stop after maximum idle time.
- Overrides:
- run in class ConnectorThread
dataTransfer
protected void dataTransfer(boolean getOrPut) throws ConnectionException
- Data transfer transaction. Currently synchronous transfer is used.
- Parameters:
- getOrPut - Get or Put operation. PUT is true.
closePortConnector
protected void closePortConnector()
- Close port connector
sendMessageToServer
protected void sendMessageToServer(String msg) throws ConnectionException
- Send a message to server side
- Parameters:
- msg - FTP message
- Throws: ConnctionException
- if writing fails
sendMessageToClient
protected void sendMessageToClient(String msg) throws ConnectionException
- Send a message to applet side
- Parameters:
- msg - FTP message
- Throws: ConnctionException
- if writing fails
createFTPPortThread
protected void createFTPPortThread() throws ConnectionException
- Create FTP PORT thread to process data
FTPPortThread will create two server socket, one for server side and one for applet side.
Port number will be passed according to protocol format.
disconnectCon
public void disconnectCon()
- Will be invoked by timer, if time out reached. Stop FTPConPortThread if still alive
- Overrides:
- disconnectCon in class ConnectorThread
All Packages Class Hierarchy This Package Previous Next Index