org.exolab.core.ipc
Class Client

java.lang.Object
  extended by org.exolab.core.ipc.Client
All Implemented Interfaces:
java.io.Serializable

public class Client
extends java.lang.Object
implements java.io.Serializable

Client side ipc connections, must connect with a host and port option. An exception is thrown if the connection fails. Currently all sends have a 10 sec timeout, receives will block until data is available.

For the initial release a positive acknowlegment is used. Clients that initiate a send should then call receive to ensure an response is received.

Version:
$Revision: 1.2 $ $Date: 2001/05/20 10:49:35 $
Author:
Jim Mourikis
See Also:
TcpService, Serialized Form

Constructor Summary
Client(java.lang.String host, int port)
          Connect to a server with the given port on the given host.
 
Method Summary
 void close()
          Close the existing service.
 java.lang.Object receive()
          Wait for an Object to be received.
 void send(java.io.Serializable ob)
          Send the specified object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Client

public Client(java.lang.String host,
              int port)
       throws java.rmi.UnknownHostException,
              java.io.IOException
Connect to a server with the given port on the given host.

Parameters:
host - The host the service is running on.
port - The connection port the server is listening on.
Throws:
java.rmi.UnknownHostException - Cannot fine the given host.
java.io.IOException - Failed to connect to the server.
Method Detail

send

public void send(java.io.Serializable ob)
          throws java.io.IOException
Send the specified object.

Parameters:
ob - The object to send. Must be serializable.
Throws:
java.io.IOException - If the data fails to write to the output stream.

receive

public java.lang.Object receive()
                         throws java.io.IOException,
                                java.lang.ClassNotFoundException
Wait for an Object to be received.

Returns:
Object The object received.
Throws:
java.io.IOException - If the data cannot be received.
java.lang.ClassNotFoundException - If the object received is unknown.

close

public void close()
           throws java.io.IOException
Close the existing service. Connections can no longer be sent or received.

Throws:
java.io.IOException - If the service fails to close.


Copyright © 1999-2012 The Exolab Group. All Rights Reserved.