kristal.client
Class TcpConnection

java.lang.Object
  extended bykristal.client.TcpConnection

public class TcpConnection
extends java.lang.Object

This Class manages a message exchange of KRISTAL.

It assumes that

See Also:
ClientLIB

Constructor Summary
TcpConnection()
           
 
Method Summary
static java.lang.String ExchangeMessage(java.lang.String out_msg, java.lang.String ip_addr, int port)
          Sends a request and receives a response.
static java.lang.String ReceiveMessage(java.io.InputStream in)
          Receives a message from KRISTAL server.
static int SendMessage(java.lang.String out_msg, java.io.OutputStream out)
          Sends a message to KRISTAL server.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TcpConnection

public TcpConnection()
Method Detail

SendMessage

public static int SendMessage(java.lang.String out_msg,
                              java.io.OutputStream out)
Sends a message to KRISTAL server.

Parameters:
out_msg - the message to send
out - the stream to use
Returns:
the size of message which was sended

ReceiveMessage

public static java.lang.String ReceiveMessage(java.io.InputStream in)
                                       throws java.lang.OutOfMemoryError
Receives a message from KRISTAL server.

Parameters:
in - the stream to use
Returns:
the message which was received
Throws:
java.lang.OutOfMemoryError

ExchangeMessage

public static java.lang.String ExchangeMessage(java.lang.String out_msg,
                                               java.lang.String ip_addr,
                                               int port)
                                        throws java.lang.OutOfMemoryError
Sends a request and receives a response.

Parameters:
out_msg - the message to send
ip_addr - the server ip address
port - the server port number
Returns:
the message which was received
Throws:
java.lang.OutOfMemoryError