|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectsquint.NetConnection
public class NetConnection
NetConnection is a class that implements a data connection that supports the transmission of text messages through the Internet to and from a program and a port on a remote computer. It uses the TCP protocol to ensure reliable, ordered delivery of all data.
Field Summary | |
---|---|
SScanner |
in
Used to access text received through this connection |
java.io.PrintWriter |
out
Used to send text through this connection |
Constructor Summary | |
---|---|
NetConnection(java.lang.String host,
int port)
Constructs a new NetConnection given a the name of a remote host and the port number on that host with which a connection should be made. |
|
NetConnection(java.lang.String host,
java.lang.String port)
Constructs a new NetConnection given a the name of a remote host and the port number on that host with which a connection should be made. |
|
NetConnection(squint.TCPSocket mySocket)
Constructs a new NetConnection 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 any listener registered for this connectoin. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public final SScanner in
public final java.io.PrintWriter out
Constructor Detail |
---|
public NetConnection(java.lang.String host, int port)
host
- the name of the remote hostport
- the number of the port to contactpublic NetConnection(java.lang.String host, java.lang.String port)
host
- the name of the remote hostport
- the number of the port to contactpublic NetConnection(squint.TCPSocket mySocket)
mySocket
- the Socket with which NETConnection 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 NetConnection's state changespublic void removeMessageListener()
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |