| Modifier and Type | Field and Description |
|---|---|
protected java.io.OutputStream |
out |
protected java.net.Socket |
sock |
| Constructor and Description |
|---|
TcpConnector(java.net.Socket sock)
Create a TCP connector object with an already open socket.
|
TcpConnector(java.lang.String hostname,
int port)
Open a TCP client connection to a TCP server.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Close the connection.
|
java.lang.String[] |
connections()
Gets a list of all known active connections
|
java.io.InputStream |
getInputStream()
Get the input stream to read data over.
|
java.lang.String |
getName()
Get a string representation of the connection.
|
java.io.OutputStream |
getOutputStream()
Get the output stream to write data to.
|
boolean |
isReliable()
Check if a connection is relaible.
|
void |
setConnectionListener(ConnectionListener listener)
Set a connection state listener.
|
java.lang.String |
toString() |
boolean |
waitOutputCompletion(long timeout)
Wait until the output buffer is empty.
|
public TcpConnector(java.lang.String hostname,
int port)
throws java.io.IOException
java.io.IOExceptionpublic TcpConnector(java.net.Socket sock)
throws java.io.IOException
java.io.IOExceptionpublic java.lang.String getName()
Connectorpublic java.io.InputStream getInputStream()
ConnectorgetInputStream in interface Connectorpublic java.io.OutputStream getOutputStream()
ConnectorgetOutputStream in interface Connectorpublic void setConnectionListener(ConnectionListener listener)
ConnectorsetConnectionListener in interface Connectorlistener - listener to call for connection/disconnection,
or null to disable listener.public void close()
Connectorpublic boolean isReliable()
ConnectorisReliable in interface Connectorpublic boolean waitOutputCompletion(long timeout)
ConnectorwaitOutputCompletion in interface Connectortimeout - timeout in milliseconds.public java.lang.String[] connections()
Connectorconnections in interface Connectorpublic java.lang.String toString()
toString in class java.lang.Object