|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectsquint.TCPConnection
public class TCPConnection
A TCPConnection is a class that implements a data connection that supports the transmission of binary and text data through the Internet to and from a program and a port on a remote computer.
Field Summary | |
---|---|
DataInputChannel |
in
Used to access data received through this connection |
DataOutputChannel |
out
Used to send data through this connection |
Constructor Summary | |
---|---|
TCPConnection(java.net.Socket aSocket)
Constructs a new TCPConnection given a Socket already connected to a remote port. |
|
TCPConnection(java.lang.String host,
int port)
Constructs a new TCPConnection given a the name of a remote host and the port number on that host with which a connection should be made. |
|
TCPConnection(java.lang.String host,
java.lang.String port)
Constructs a new TCPConnection given a the name of a remote host and the port number on that host with which a connection should be made. |
|
TCPConnection(squint.TCPSocket mySocket)
Constructs a new TCPConnection given a Socket already connected to a remote port. |
Method Summary | |
---|---|
void |
addMessageListener(TCPListener listener)
Register to be notified when new data is received through this connection and when the connection is terminated. |
void |
close()
Terminate the connection to the remote machine. |
void |
removeMessageListener()
Remove the listener registered for this connection |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public final DataInputChannel in
public final DataOutputChannel out
Constructor Detail |
---|
public TCPConnection(java.lang.String host, int port)
host
- the name of the remote hostport
- the number of the port to contactpublic TCPConnection(java.lang.String host, java.lang.String port)
host
- the name of the remote hostport
- the number of the port to contact (in String form)public TCPConnection(squint.TCPSocket mySocket)
mySocket
- the TCPSocket with which TCPConnection should be associatedpublic TCPConnection(java.net.Socket aSocket)
aSocket
- the Socket with which TCPConnection should be associatedMethod Detail |
---|
public void close()
public void addMessageListener(TCPListener listener)
listener
- the object whose dataReceived and connectionClosed methods
should be invoked when the TCPConnection's state changespublic void removeMessageListener()
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |