jfreerails.network
Class InetConnection2Client

java.lang.Object
  extended by jfreerails.network.AbstractInetConnection
      extended by jfreerails.network.InetConnection2Client
All Implemented Interfaces:
java.lang.Runnable, Connection2Client

public class InetConnection2Client
extends AbstractInetConnection
implements Connection2Client

Lets the server send messages to a client over the Internet.

Author:
Luke

Constructor Summary
InetConnection2Client(java.net.Socket s)
           
 
Method Summary
(package private)  java.lang.String getThreadName()
           
 FreerailsSerializable[] readFromClient()
          Returns an array containing all the objects read from the client since the last time this method or waitForObjectFromClient() was called, if no objects have been received, it returns an empty array rather than blocking.
 FreerailsSerializable waitForObjectFromClient()
          Returns the next object read from the client, blocking if non is available.
 void writeToClient(FreerailsSerializable object)
          Sends the specified object to the client.
 
Methods inherited from class jfreerails.network.AbstractInetConnection
disconnect, flush, isOpen, read, run, send, setTimeOut, waitForObject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface jfreerails.network.Connection2Client
disconnect, flush, isOpen
 

Constructor Detail

InetConnection2Client

public InetConnection2Client(java.net.Socket s)
                      throws java.io.IOException
Throws:
java.io.IOException
Method Detail

readFromClient

public FreerailsSerializable[] readFromClient()
                                       throws java.io.IOException
Description copied from interface: Connection2Client
Returns an array containing all the objects read from the client since the last time this method or waitForObjectFromClient() was called, if no objects have been received, it returns an empty array rather than blocking.

Specified by:
readFromClient in interface Connection2Client
Throws:
java.io.IOException

waitForObjectFromClient

public FreerailsSerializable waitForObjectFromClient()
                                              throws java.io.IOException,
                                                     java.lang.InterruptedException
Description copied from interface: Connection2Client
Returns the next object read from the client, blocking if non is available.

Specified by:
waitForObjectFromClient in interface Connection2Client
Throws:
java.io.IOException
java.lang.InterruptedException

writeToClient

public void writeToClient(FreerailsSerializable object)
                   throws java.io.IOException
Description copied from interface: Connection2Client
Sends the specified object to the client.

Specified by:
writeToClient in interface Connection2Client
Throws:
java.io.IOException

getThreadName

java.lang.String getThreadName()
Specified by:
getThreadName in class AbstractInetConnection