com.threerings.presents.net
Class PongResponse

java.lang.Object
  extended by com.threerings.io.SimpleStreamableObject
      extended by com.threerings.presents.net.Message
          extended by com.threerings.presents.net.DownstreamMessage
              extended by com.threerings.presents.net.PongResponse
All Implemented Interfaces:
Streamable

public class PongResponse
extends DownstreamMessage

Let's the client know the server heard its ping (and that the server and connection are still alive).


Nested Class Summary
 
Nested classes/interfaces inherited from interface com.threerings.io.Streamable
Streamable.Closure
 
Field Summary
protected  long _packStamp
          The timestamp obtained immediately before this packet was sent out over the network.
protected  long _pingStamp
          The ping unpack stamp provided at construct time to this pong response; only valid on the sending process, not the receiving process.
protected  int _processDelay
          The delay in milliseconds between the time that the ping request was read from the network and the time the pong response was written to the network.
protected  Transport _transport
          The transport parameters.
protected  long _unpackStamp
          A time stamp obtained when we unserialize this object (the intent is to get a timestamp as close as possible to when the packet was received on the network).
 
Fields inherited from class com.threerings.presents.net.DownstreamMessage
messageId
 
Fields inherited from class com.threerings.presents.net.Message
received
 
Constructor Summary
PongResponse()
          Zero argument constructor used when unserializing an instance.
PongResponse(long pingStamp, Transport transport)
          Constructs a pong response which will use the supplied ping time to establish the end-to-end processing delay introduced by the server.
 
Method Summary
 long getPackStamp()
          Returns the time at which this packet was packed for delivery in the time frame of the server that sent the packet.
 int getProcessDelay()
          Returns the number of milliseconds that elapsed between the time that the ping which instigated this pong was read from the network and the time that this pong was written to the network.
 Transport getTransport()
          Returns the message transport parameters.
 long getUnpackStamp()
          Returns a timestamp that was obtained when this packet was decoded by the low-level networking code.
 void readObject(ObjectInputStream in)
          Reads our custom streamable fields.
 void setTransport(Transport transport)
          Sets the message transport parameters.
 String toString()
           
 void writeObject(ObjectOutputStream out)
          Writes our custom streamable fields.
 
Methods inherited from class com.threerings.presents.net.Message
noteActualTransport
 
Methods inherited from class com.threerings.io.SimpleStreamableObject
toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_pingStamp

protected transient long _pingStamp
The ping unpack stamp provided at construct time to this pong response; only valid on the sending process, not the receiving process.


_packStamp

protected long _packStamp
The timestamp obtained immediately before this packet was sent out over the network.


_processDelay

protected int _processDelay
The delay in milliseconds between the time that the ping request was read from the network and the time the pong response was written to the network.


_unpackStamp

protected transient long _unpackStamp
A time stamp obtained when we unserialize this object (the intent is to get a timestamp as close as possible to when the packet was received on the network).


_transport

protected transient Transport _transport
The transport parameters.

Constructor Detail

PongResponse

public PongResponse()
Zero argument constructor used when unserializing an instance.


PongResponse

public PongResponse(long pingStamp,
                    Transport transport)
Constructs a pong response which will use the supplied ping time to establish the end-to-end processing delay introduced by the server.

Method Detail

getPackStamp

public long getPackStamp()
Returns the time at which this packet was packed for delivery in the time frame of the server that sent the packet.


getProcessDelay

public int getProcessDelay()
Returns the number of milliseconds that elapsed between the time that the ping which instigated this pong was read from the network and the time that this pong was written to the network.


getUnpackStamp

public long getUnpackStamp()
Returns a timestamp that was obtained when this packet was decoded by the low-level networking code.


writeObject

public void writeObject(ObjectOutputStream out)
                 throws IOException
Writes our custom streamable fields.

Throws:
IOException

readObject

public void readObject(ObjectInputStream in)
                throws IOException,
                       ClassNotFoundException
Reads our custom streamable fields.

Throws:
IOException
ClassNotFoundException

setTransport

public void setTransport(Transport transport)
Description copied from class: Message
Sets the message transport parameters. For messages received over the network, these describe the mode of transport over which the message was received. When sending messages, they act as a hint as to the type of transport desired. Calling this method may have no effect, depending on whether non-default modes of transport are supported for this message type.

Overrides:
setTransport in class Message

getTransport

public Transport getTransport()
Description copied from class: Message
Returns the message transport parameters.

Overrides:
getTransport in class Message

toString

public String toString()
Overrides:
toString in class DownstreamMessage