Game Development Reference
In-Depth Information
Object serialization
Any objects needing synchronization across players are transmitted as messages over
the network. This module is responsible for converting a given object to a compact
binary format, sometimes encrypting prior to sending over the network. The module
also performs the complimentary function where the received binary messages are
de-serialized when a message arrives at the destination over the network.
A typical message format is sent between client and server. These message exchanges
are the basic building blocks of any networked client-server implementation.
Security
Flash runtime has a built-in security, so flash clients cannot simply open socket
connections to any server it wants. The server the client wants to connect to must
grant explicit permission to the client requesting it.
This module just does that. When the client creates a socket object and wants to
connect to the server, the flash runtime first requests security policy, the request is
received and sends back a policy data specifying that it is okay for the client to open
a socket connection to the server.
Connection management and message dispatcher
This module is the workhouse for receiving messages from clients and routing them to
different modules or services. The module is also responsible for dispatching messages
generated from the server to the clients. Upon server start up, this service could spawn
multiple threads that loop infinitely until the server process is terminated. This object
does the following in a loop:
1.
Checks for any new client connections.
2.
If a new client connection is detected, a session object is created for the
connection and adds the new session to the active list.
3.
For each session in the active list, calls read and write methods.
4.
Also detects any client termination and cleans up the corresponding
session object.
 
Search WWH ::




Custom Search