|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnetwork.AbCommsTCP
public abstract class AbCommsTCP
Created on November 8, 2006, 4:31 PM
Abstract comms used as the parent for SendComms and RecieveComms.
Uses datagrams to handle the communications.
Sending or waiting for acks is handled by the classes that implement AbCommsTCP.
Each child implements and uses the socket, packet, remoteHost, and connectedAddress variables differently.
Created to help simplify and organize communications.
t.5 Changed from using datagrams to using tcp sockets instead.
| Constructor Summary | |
|---|---|
AbCommsTCP()
Creates a new instance of AbCommsTCP |
|
| Method Summary | |
|---|---|
void |
addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Adds the property change listener. |
byte[] |
getBuffer()
The buffer of data to be sent. |
java.net.InetAddress |
getConnectedAddress()
Get the address the socket is connected to. |
int |
getPort()
Gets the port number the socket is bound. |
java.beans.PropertyChangeSupport |
getPropertySupport()
Gets the property change support. |
java.lang.String |
getRemoteHost()
Gets the remote host. |
java.lang.Thread |
getRunner()
Gets the thread that is running. |
java.net.Socket |
getSocket()
Gets the socket used for communications. |
boolean |
isAckRequired()
Whether an ack is required or not. Not used when using tcp sockets. |
boolean |
isAlreadyConnected()
Whether the socket is already connected or not. |
boolean |
isPauseComms()
The pause state of communications. |
boolean |
isRunning()
Whether the thread should be running or not. |
void |
removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Removes the property change listener. |
abstract void |
run()
Abstract run. Used in subclasses to handle communications. |
void |
setAckRequired(boolean ackRequired)
Set whether an ack is required or not. |
void |
setAlreadyConnected(boolean alreadyConnected)
Set the connection status of the socket. |
void |
setBuffer(byte[] buffer)
Sets the data buffer that is to be sent. |
void |
setConnectedAddress(java.net.InetAddress connectedAddress)
Sets the connected address. |
void |
setPauseComms(boolean pauseComms)
Sets the pause state of communications. |
void |
setPort(int port)
Set the port number to use. |
void |
setRemoteHost(java.lang.String remoteHost)
Sets the remote host connected to. |
void |
setRunner(java.lang.Thread runner)
Sets the running thread. |
void |
setRunning(boolean running)
Set the thread's current running state. |
void |
setSocket(java.net.Socket socket)
Sets the socket to use for communications. |
void |
startComms()
Starts the communications. |
void |
stopComms()
Stops the communications. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public AbCommsTCP()
| Method Detail |
|---|
public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
listener - The new listener.public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
listener - The listener to remove.public java.beans.PropertyChangeSupport getPropertySupport()
public java.lang.Thread getRunner()
public void setRunner(java.lang.Thread runner)
runner - The new thread to run.public boolean isRunning()
public void setRunning(boolean running)
running - True if running, otherwise false.public boolean isPauseComms()
public void setPauseComms(boolean pauseComms)
pauseComms - The new pause state.public java.lang.String getRemoteHost()
public void setRemoteHost(java.lang.String remoteHost)
remoteHost - The new remote host.public java.net.Socket getSocket()
public void setSocket(java.net.Socket socket)
socket - The new socket to use.public boolean isAlreadyConnected()
public void setAlreadyConnected(boolean alreadyConnected)
alreadyConnected - The new connection status of the socket.public java.net.InetAddress getConnectedAddress()
public void setConnectedAddress(java.net.InetAddress connectedAddress)
connectedAddress - The new address connected.public int getPort()
public void setPort(int port)
port - The new port number.public byte[] getBuffer()
public void setBuffer(byte[] buffer)
buffer - The string to be sent as a buffer array.public boolean isAckRequired()
public void setAckRequired(boolean ackRequired)
ackRequired - True if require an ack, otherwise false.public void startComms()
public void stopComms()
public abstract void run()
run in interface java.lang.Runnable
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||