Class NetworkProtocolConstants
java.lang.Object
org.web3d.vrml.scripting.external.neteai.NetworkProtocolConstants
NetworkProtocolConstants is a utility class for specifying constants for the
communications framework and utility methods for reading and writing data.
Upon opening a connection, the client will transmit the integer
CONNECTION_MAGIC_NUMBER_CLIENT and expect to read CONNECTION_MAGIC_NUMBER_SERVER.
The server expects to read CONNECTION_MAGIC_NUMBER_CLIENT and then transmits
CONNECTION_MAGIC_NUMBER_SERVER. Deviation from this handshake routine
causes the connection to be closed.
The network protocol is broken into a sequence of packets.
Requests from the client to the server follows the format of
<PACKET_TYPE>
<PACKET_ID>
<PACKET_DATA>
Responses to client requests follow the format
<PACKET_TYPE>
<PACKET_ID>
<RESPONSE_TYPE>
<PACKET_DATA>
where PACKET_ID for a response matches the PACKET_ID of the
original request, and RESPONSE_TYPE is a normal response
(calling method should return normally),
an unexpected error (calling method should indicate a
run time exception), or a routine exception response
(calling method should generate an expected exception).
For spontaneous client to server messages such as
the various event notifications, the format is instead
<PACKET_TYPE>
<PACKET_DATA>
The format of PACKET_DATA is naturally specific to the packet type.
When dealing with arrays, the array length is transmitted before
the array elements. For null arrays an array length of -1 is
specified.
For Node objects only the ID number of each node is specified.
The ID -1 is reserved to specify a null Node object.
Strings are transmitted using the readUTF and writeUTF methods.
All other field types (int, float, etc.) use the appropriate
read and write methods on the data input/output stream.
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
NetworkProtocolConstants
public NetworkProtocolConstants()
-