Purple Code

com.purpletech.message.server
Class RemoteClient

java.lang.Object
  |
  +--com.purpletech.message.server.RemoteClient
All Implemented Interfaces:
Client

public class RemoteClient
extends java.lang.Object
implements Client

This is the Client as seen by the server. It processes input and output for a single client

Version:
$Id: RemoteClient.java,v 1.2 2001/10/30 12:20:52 alex Exp $
Author:
Alex

Constructor Summary
RemoteClient(java.net.Socket socket, int id)
          Initialize this object.
 
Method Summary
 void close()
          tell this client to go bye-bye.
 int getID()
          Accessor
 long getLastReceived()
          system (local) time when the last message was received from this client
 long getLastSent()
          system (local) time when the last message was sent to this client
 Message receiveMessage()
          the server calls this method to find out if a message is available and, if so, to receive it
 void sendMessage(Message m)
          Send a message down the socket
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RemoteClient

public RemoteClient(java.net.Socket socket,
                    int id)
             throws java.io.IOException
Initialize this object.

Method Detail

getID

public int getID()
Accessor

Specified by:
getID in interface Client

getLastSent

public long getLastSent()
Description copied from interface: Client
system (local) time when the last message was sent to this client

Specified by:
getLastSent in interface Client

getLastReceived

public long getLastReceived()
Description copied from interface: Client
system (local) time when the last message was received from this client

Specified by:
getLastReceived in interface Client

sendMessage

public void sendMessage(Message m)
                 throws java.io.IOException
Send a message down the socket

Specified by:
sendMessage in interface Client
java.io.IOException

receiveMessage

public Message receiveMessage()
                       throws java.io.IOException
Description copied from interface: Client
the server calls this method to find out if a message is available and, if so, to receive it

Specified by:
receiveMessage in interface Client
Returns:
the newly received message
java.io.IOException

close

public void close()
Description copied from interface: Client
tell this client to go bye-bye. What happens if it's in the middle of receiving or sending a message in another thread? I don't know.

Specified by:
close in interface Client

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

Documentation generated March 5 2003