*              How ScriptEZ.API wraps and unwraps data/messages for your sake ?

 

 

(1) Typology for TCP/IP server in methods/properties calling: see an example

1. Initialisation:

Call to CreatePoolSocketServerObject(…) to instantiate a server and to wait for incoming connections (listening)

 

2. Incoming Connection

  (notification):

onConnectionRequest(…) is called when an incoming connection occurs. At this point, the server can optionally call to AddSocketClientObjectEventHandlers(…) or can return 1, to accept the client request and delegate the conversation between a socket client proxy object and the remote client.
 
(!)  In the contrary, the server can deny a connection by returning 0.

 

3. Conversation (...):

onData(…) is called for each handle of socket proxy object per client to deal with received messages and responses, by calling to SendSocketObjectData(…) or SendSocketObjectBinaryData(…)
 
During this step, the server remains parallely ready to accept or to refuse a new incoming connection !

 

4. End of conversation:

onConnectionState(…)  is called for each handle of socket proxy object per client with a description of a socket proxy object status ( closed or broken ), plus an error number:
 
   . 'error_number = 10054  ' means the connection is closed gracefully.
   . 'error_number = <other values>' means the connection is broken.

 

5. End of the server:

The server object is destroyed when ScriptEZ.API object is released or when the application exits.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 



client-server

. Thread pooled Server                      . Remote Client(s)

 

(2) Typology for TCP/IP client in methods/properties calling: see an example

1. Initialisation :

Call to CreateSocketClientObjectEx(…) to instantiate a client object.

 

2. Outcoming Connection:

Call to ConnectSocketServerObject(…) to  initiate a connection with a server.

 

If a first connection to a server happened well, but in the meantime the network is broken or the server is gone,

the ScriptEZ.API component provides an auto-reconnection feature from within the client side without any extra work.

 

 

3. Accepted or Denied

 Connection (notification):

onConnectionState(…) is called and provides a handle of socket client object (hOwnerSocket), with a description

( connected, closed or broken ), plus an error number:
 
  . 'error_number = 0      '  means the connection is established or re-established.
  . 'error_number = 10054  ' means the connection is closed gracefully or refused.
  . 'error_number = <other values>' means the connection is broken.

 

4. Conversation (...) :

if a connection is established, calls to  SendSocketObjectData(…) or SendSocketObjectBinaryData(…) will send data or messages to the server...
                                  
onData(…) is called if responses from the server occur and are received, this should be dealt with and so on.

 

5. End of conversation :

The conversation is terminated when ScriptEZ.API object is released, the application exits or the server is gone.