sconemad

technology, scones, nonsense

Loading...

Profiles

Twitter

GitHub

Launchpad

Subscribe to my RSS Feed

Admin

server

The server module plays a vital role in the SconeServer framework, as it is used to listen for and accept incoming connections, passing them on to the appropriate module(s) for processing. This is done by defining connection chains, which list the module(s) to be notified in the event of a particular connection. Each entry in the connection chain can also include any number of arguments, which are passed along to the module with the notification.

Connections

The module creates listeners where required. These accept any incoming connections and pass them directly to the server module along with the name of the associated connection chain. The server module traverses the connection chain, notifying each module in turn of the connection, passing along any associated arguments. Assuming each module responds positively, the connection is added to the SconeServer kernel.

Sub-chains

server.chain_name.add( "server", sub-chain-name : String )

It is possible to specify the server module itself within a connection chain, specifying the name of another chain as an argument. The effect of this is that the other chain will be traversed at this point - returning to the original chain when finished. This is analogous to a subroutine in a programming language, and allows shared chains to be setup, which can be reused and maintained more easily in configuration files.

 server.add("A")
  server.A.add("module1"))
  server.A.add("module2"))
  server.A.add("server","B")
  server.A.add("module3"))
  server.A.add("module4"))
  server.A.listen(ip.addr("*",9999))

 server.add("B")
  server.B.add("module5")
  server.B.add("module6")

In this example, any incoming connections on port 9999 will be passed to the following modules in turn:

SconeScript Interface

In addition to the standard module interface, it also has the following:

Properties

Name Type Descripion
list List of ConnectionChain Returns a list of currently defined connection chains.

Methods

add ( name : String )
Adds a new connection chain.
remove ( name : String )
Removes a connection chain.
Updated on 2012-02-02 09:39:09 +0000 | Requested on 2021-05-12 18:17:21 +0000