com.msi.network.connection
Class clientTCPConnection

java.lang.Object
  extended bycom.msi.network.connection.clientTCPConnection
All Implemented Interfaces:
clientConnection

public class clientTCPConnection
extends java.lang.Object
implements clientConnection

Describe class clientTCPConnection here.

Version:
1.0
Author:
thompson@milestonesolutions.com

Field Summary
private  java.net.Socket _cSock
           
private  java.io.InputStream _in
           
private  java.io.OutputStream _out
           
(package private)  java.net.InetAddress destination
           
(package private)  int port
           
 
Constructor Summary
clientTCPConnection(java.net.InetAddress dst, int port)
          Opens a connection to the specified system and port combination.
 
Method Summary
 void close()
          Close out the connection to the server and free any system resources.
protected  void finalize()
          Make sure we close the connection if anything bad happens.
 java.lang.String getLine()
          Gets a line of output from the TCP/IP server.
 int getServerPort()
          Return the server port associated with this connection.
 void putLine(java.lang.String line)
          Send a line to the server.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

destination

java.net.InetAddress destination

port

int port

_cSock

private java.net.Socket _cSock

_in

private java.io.InputStream _in

_out

private java.io.OutputStream _out
Constructor Detail

clientTCPConnection

public clientTCPConnection(java.net.InetAddress dst,
                           int port)
                    throws java.lang.Exception
Opens a connection to the specified system and port combination.

Parameters:
dst - an InetAddress value
port - an int value
Throws:
java.lang.Exception - if an error occurs
Method Detail

getLine

public java.lang.String getLine()
                         throws java.lang.Exception
Gets a line of output from the TCP/IP server.

Sometimes it is possible to 'outrun' the remote server or the intervening network. A brief delay is provided to overcome this temporary and often initial, buffer-empty condition.

Specified by:
getLine in interface clientConnection
Returns:
text from the server with end of line characters stripped.
Throws:
java.lang.Exception - if an error occurs

putLine

public void putLine(java.lang.String line)
Send a line to the server.

Specified by:
putLine in interface clientConnection
Parameters:
line - to send.

close

public void close()
Close out the connection to the server and free any system resources.

Specified by:
close in interface clientConnection

finalize

protected void finalize()
                 throws java.lang.Throwable
Make sure we close the connection if anything bad happens. The application programmer should close the connection after use.

Throws:
java.lang.Throwable - if an error occurs

getServerPort

public int getServerPort()
Return the server port associated with this connection.

Specified by:
getServerPort in interface clientConnection
Returns:
the port for this connection.


Copyright © 2001-2002 MileStone Solutions, Inc. All Rights Reserved.