krb5.util
Class TCPClient

java.lang.Object
  extended by krb5.util.TCPClient

public class TCPClient
extends java.lang.Object

Class Description : TCPClient instantiates a TCP Client. A modified version of the code obtained from the Open Group Research Institute.

Version:
1.1
Author:
Bojan Pajkovski

Constructor Summary
TCPClient(java.net.InetAddress iaddr, int port)
          Class constructor specifying the ip address and the port.
TCPClient(java.net.Socket sock)
          Class constructor specifying the socket.
TCPClient(java.lang.String hostname, int port)
          Class constructor specifying the host name and the port.
 
Method Summary
 void close()
          Closes the connection
 java.net.InetAddress getInetAddress()
          Gets the inet address
 byte[] receive()
          Receives an array of bytes
 void send(byte[] data)
          Sends an array of bytes
 void setBufSize(int newBufSize)
          Sets the buffer size.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TCPClient

public TCPClient(java.net.InetAddress iaddr,
                 int port)
          throws java.io.IOException
Class constructor specifying the ip address and the port.

Parameters:
iaddr - is of type InetAddress
port - is of type int
Throws:
java.io.IOException - an exception
See Also:
InetAddress, IOException

TCPClient

public TCPClient(java.lang.String hostname,
                 int port)
          throws java.io.IOException
Class constructor specifying the host name and the port.

Parameters:
hostname - is of type String
port - is of type int
Throws:
java.io.IOException - an exception
See Also:
IOException

TCPClient

public TCPClient(java.net.Socket sock)
          throws java.io.IOException
Class constructor specifying the socket.

Parameters:
sock - is of type Socket
Throws:
java.io.IOException - an exception
See Also:
Socket, IOException
Method Detail

setBufSize

public void setBufSize(int newBufSize)
Sets the buffer size.

Parameters:
newBufSize - is of type int

getInetAddress

public java.net.InetAddress getInetAddress()
Gets the inet address

Returns:
InetAddress is a result
See Also:
InetAddress

send

public void send(byte[] data)
          throws java.io.IOException
Sends an array of bytes

Parameters:
data - is of type byte[]
Throws:
java.io.IOException - an exception
See Also:
IOException

receive

public byte[] receive()
               throws java.io.IOException
Receives an array of bytes

Returns:
byte[] is a result
Throws:
java.io.IOException - an exception
See Also:
IOException

close

public void close()
           throws java.io.IOException
Closes the connection

Throws:
java.io.IOException - an exception
See Also:
IOException