My Project
Public Member Functions | Static Public Member Functions | List of all members
NPL::CNPLRuntime Class Reference

CNPLRuntime is a wrapper of the NPL application programming interface (NPL API). More...

#include <NPLRuntime.h>

Inheritance diagram for NPL::CNPLRuntime:
ParaEngine::IAttributeFields NPL::INPLRuntime ParaEngine::IObject ParaEngine::BaseInterface ParaEngine::CRefCounted

Public Member Functions

 CNPLRuntime ()
 command line: local="config/local.ini"
 
virtual void Init ()
 initialize NPL runtime environment
 
virtual void Run (bool bToEnd=true)
 call this function regularly, to process packages. More...
 
virtual void Cleanup ()
 clean up the NPL runtime environment
 
virtual int GetAttributeClassID ()
 attribute class ID should be identical, unless one knows how overriding rules work. More...
 
virtual const char * GetAttributeClassName ()
 a static string, describing the attribute class object's name
 
virtual const char * GetAttributeClassDescription ()
 a static string, describing the attribute class object
 
virtual int InstallFields (ParaEngine::CAttributeClass *pClass, bool bOverride)
 this class should be implemented if one wants to add new attribute. More...
 
virtual int GetChildAttributeObjectCount (int nColumnIndex=0)
 get the number of child objects (row count) in the given column. More...
 
virtual ParaEngine::IAttributeFieldsGetChildAttributeObject (int nRowIndex, int nColumnIndex=0)
 
 ATTRIBUTE_METHOD1 (CNPLRuntime, IsServerStarted_s, bool *)
 
 ATTRIBUTE_METHOD1 (CNPLRuntime, GetHostIP_s, const char **)
 
 ATTRIBUTE_METHOD1 (CNPLRuntime, GetHostPort_s, const char **)
 
 ATTRIBUTE_METHOD1 (CNPLRuntime, IsTCPKeepAliveEnabled_s, bool *)
 
 ATTRIBUTE_METHOD1 (CNPLRuntime, SetTCPKeepAlive_s, bool)
 
 ATTRIBUTE_METHOD1 (CNPLRuntime, IsKeepAliveEnabled_s, bool *)
 
 ATTRIBUTE_METHOD1 (CNPLRuntime, SetKeepAlive_s, bool)
 
 ATTRIBUTE_METHOD1 (CNPLRuntime, IsIdleTimeoutEnabled_s, bool *)
 
 ATTRIBUTE_METHOD1 (CNPLRuntime, EnableIdleTimeout_s, bool)
 
 ATTRIBUTE_METHOD1 (CNPLRuntime, GetIdleTimeoutPeriod_s, int *)
 
 ATTRIBUTE_METHOD1 (CNPLRuntime, SetIdleTimeoutPeriod_s, int)
 
 ATTRIBUTE_METHOD1 (CNPLRuntime, GetCompressionLevel_s, int *)
 
 ATTRIBUTE_METHOD1 (CNPLRuntime, SetCompressionLevel_s, int)
 
 ATTRIBUTE_METHOD1 (CNPLRuntime, GetCompressionThreshold_s, int *)
 
 ATTRIBUTE_METHOD1 (CNPLRuntime, SetCompressionThreshold_s, int)
 
 ATTRIBUTE_METHOD1 (CNPLRuntime, IsAnsiMode_s, bool *)
 
 ATTRIBUTE_METHOD1 (CNPLRuntime, EnableAnsiMode_s, bool)
 
 ATTRIBUTE_METHOD1 (CNPLRuntime, GetMaxPendingConnections_s, int *)
 
 ATTRIBUTE_METHOD1 (CNPLRuntime, SetMaxPendingConnections_s, int)
 
 ATTRIBUTE_METHOD1 (CNPLRuntime, GetLogLevel_s, int *)
 
 ATTRIBUTE_METHOD1 (CNPLRuntime, SetLogLevel_s, int)
 
virtual void SetUseCompression (bool bCompressIncoming, bool bCompressOutgoing)
 whether to use compression on transport layer for incoming and outgoing connections More...
 
virtual void SetCompressionKey (const byte *sKey=0, int nSize=0, int nUsePlainTextEncoding=0)
 set the compression method of incoming the outgoing messages. More...
 
virtual void SetCompressionLevel (int nLevel)
 Set the zlib compression level to use in case compression is enabled. More...
 
virtual int GetCompressionLevel ()
 
virtual void SetCompressionThreshold (int nThreshold)
 set the default compression threshold for all connections on this machine. More...
 
virtual int GetCompressionThreshold ()
 
virtual void SetTCPKeepAlive (bool bEnable)
 System level Enable/disable SO_KEEPALIVE. More...
 
virtual bool IsTCPKeepAliveEnabled ()
 whether SO_KEEPALIVE is enabled. More...
 
virtual void SetKeepAlive (bool bEnable)
 enable application level keep alive. More...
 
virtual bool IsKeepAliveEnabled ()
 
virtual void EnableIdleTimeout (bool bEnable)
 Enable idle timeout. More...
 
virtual bool IsIdleTimeoutEnabled ()
 
virtual void SetIdleTimeoutPeriod (int nMilliseconds)
 how many milliseconds of inactivity to assume this connection should be timed out. More...
 
virtual int GetIdleTimeoutPeriod ()
 
virtual void EnableAnsiMode (bool bEnable)
 whether the first line of the NPL protocol is in ansi code page. More...
 
virtual bool IsAnsiMode ()
 
virtual int GetMaxPendingConnections ()
 queue size of the server acceptor's queue. More...
 
virtual void SetMaxPendingConnections (int val)
 
virtual const std::string & GetHostPort ()
 get the host port of this NPL runtime
 
virtual const std::string & GetHostIP ()
 get the host IP of this NPL runtime
 
virtual bool IsServerStarted ()
 whether the NPL runtime's http server is started. More...
 
void NPL_LoadFile (NPLRuntimeState_ptr runtime_state, const char *filePath, bool bReload)
 load a file (in the specified runtime state) without running it. More...
 
int NPL_Activate (NPLRuntimeState_ptr runtime_state, const char *sNeuronFile, const char *code=NULL, int nLength=0, int channel=0, int priority=2, int reliability=3)
 activate the specified file. More...
 
virtual int Activate (INPLRuntimeState *pRuntimeState, const char *sNeuronFile, const char *code=NULL, int nLength=0, int channel=0, int priority=2, int reliability=3)
 same as NPL_Activate
 
virtual int ActivateLocalNow (const char *sNeuronFile, const char *code=NULL, int nLength=0)
 activate immediately for the local file (may be in different thread). More...
 
void NPL_StartNetServer (const char *server=NULL, const char *port=NULL)
 start the NPL net server's io_service loop. More...
 
void NPL_StopNetServer ()
 stop the net server
 
void NPL_AddPublicFile (const string &filename, int nID)
 add a nID, filename pair to the public file list. More...
 
void NPL_ClearPublicFiles ()
 clear all public files, so that the NPL server will be completely private. More...
 
string NPL_GetIP (const char *nid)
 get the ip address of given NPL connection. More...
 
void NPL_accept (const char *tid, const char *nid=NULL)
 accept a given connection. More...
 
void NPL_SetProtocol (const char *nid, int protocolType=0)
 set transmission protocol, default value is 0. More...
 
void NPL_reject (const char *nid, int nReason=0)
 reject and close a given connection. More...
 
virtual void StartNetServer (const char *server=NULL, const char *port=NULL)
 start the NPL net server's io_service loop. More...
 
virtual void StopNetServer ()
 stop the net server
 
virtual void AddPublicFile (const string &filename, int nID)
 
virtual void ClearPublicFiles ()
 clear all public files, so that the NPL server will be completely private. More...
 
virtual void GetIP (const char *nid, char *pOutput)
 get the ip address of given NPL connection. More...
 
virtual void accept (const char *tid, const char *nid=NULL)
 accept a given connection. More...
 
virtual void reject (const char *nid, int nReason=0)
 reject and close a given connection. More...
 
virtual ParaEngine::INPLJabberClientGetJabberClient (const char *sJID)
 get an existing jabber client instance interface by its JID. More...
 
virtual ParaEngine::INPLJabberClientCreateJabberClient (const char *sJID)
 Create a new jabber client instance with the given jabber client ID. More...
 
virtual bool CloseJabberClient (const char *sJID)
 close a given jabber client instance. More...
 
virtual bool AppendURLRequest (ParaEngine::CURLRequestTask *pUrlTask, const char *sPoolName=NULL)
 Append URL request to a pool. More...
 
virtual bool ChangeRequestPoolSize (const char *sPoolName, int nCount)
 There is generally no limit to the number of requests sent. More...
 
virtual void AsyncDownload (const char *url, const char *destFolder, const char *callbackScript, const char *DownloaderName)
 Asynchronously download a file from the url. More...
 
virtual void CancelDownload (const char *DownloaderName)
 cancel all asynchronous downloads that matches a certain downloader name pattern More...
 
virtual int Download (const char *url, const char *destFolder, const char *callbackScript, const char *DownloaderName)
 Synchronous call of the function AsyncDownload(). More...
 
void NPL_RegisterWSCallBack (const char *sWebServiceFile, const char *sCode)
 this method will associate a web service (method) with either a sCode, which will be called when the web service returned. More...
 
void NPL_UnregisterWSCallBack (const char *sWebServiceFile)
 unregister web service call back for a given file. More...
 
bool NPL_SetTimer (NPLRuntimeState_ptr runtime_state, int nIDEvent, float fElapse, const char *sNeuronFile)
 creates a timer with the specified time-out value [thread safe] More...
 
bool NPL_KillTimer (NPLRuntimeState_ptr runtime_state, int nIDEvent)
 Destroys the specified timer [thread safe]. More...
 
bool NPL_ChangeTimer (NPLRuntimeState_ptr runtime_state, int nIDEvent, int dueTime, int period)
 Changes the start time and the interval between method invocations for a timer, using 32-bit signed integers to measure time intervals. More...
 
virtual void NPL_AddDNSRecord (const char *sDNSName, const char *sAddress)
 add a DNS server record to the current NPL runtime. More...
 
virtual void NPL_SetDefaultChannel (int channel_ID)
 Set the default channel ID, default value is 0. More...
 
virtual int NPL_GetDefaultChannel ()
 Get the default channel ID, default value is 0. More...
 
virtual void NPL_SetChannelProperty (int channel_ID, int priority, int reliability)
 Messages can be sent via predefined channels. More...
 
virtual void NPL_ResetChannelProperties ()
 reset all 16 predefined channel properties. More...
 
virtual void NPL_GetChannelProperty (int channel_ID, int *priority, int *reliability)
 see also NPL_SetChannelProperty More...
 
void NPL_EnableNetwork (bool bEnable, const char *CenterName, const char *password)
 OBSOLETED: Enable the network, by default the network layer is disabled. More...
 
const string & NPL_GetSourceName ()
 get the current activation's source name. More...
 
void NPL_SetSourceName (const char *sName)
 Set the current activation's source name. More...
 
int GetLogLevel () const
 
void SetLogLevel (int val)
 
virtual INPLRuntimeStateCreateState (const char *name, NPLRuntimeStateType type_=NPLRuntimeStateType_NPL)
 create a new runtime state. More...
 
virtual INPLRuntimeStateGetState (const char *name)
 get a runtime state with an explicit name. More...
 
virtual INPLRuntimeStateCreateGetState (const char *name, NPLRuntimeStateType type_=NPLRuntimeStateType_NPL)
 it get runtime state first, if none exist, it will create one and add it to the main threaded state
 
virtual bool DeleteState (INPLRuntimeState *pRuntime_state)
 create a given runtime state. More...
 
virtual INPLRuntimeStateGetMainState ()
 get the default (main) runtime state. More...
 
virtual bool AddToMainThread (INPLRuntimeState *runtime_state)
 add a given runtime state to the main game thread. More...
 
NPLRuntimeState_ptr CreateRuntimeState (const string &name, NPLRuntimeStateType type_=NPLRuntimeStateType_NPL)
 create a new runtime state. More...
 
NPLRuntimeState_ptr GetRuntimeState (const string &name)
 get a runtime state with an explicit name. More...
 
NPLRuntimeState_ptr CreateGetRuntimeState (const string &name, NPLRuntimeStateType type_=NPLRuntimeStateType_NPL)
 it get runtime state first, if none exist, it will create one and add it to the main threaded state
 
bool DeleteRuntimeState (NPLRuntimeState_ptr runtime_state)
 create a given runtime state. More...
 
NPLRuntimeState_ptr GetMainRuntimeState ()
 get the default (main) runtime state. More...
 
bool AddStateToMainThread (NPLRuntimeState_ptr runtime_state)
 add a given runtime state to the main game thread. More...
 
bool RemoveStateFromMainThread (NPLRuntimeState_ptr runtime_state)
 remove a given runtime state from the main game thread. More...
 
CNPLNetServerGetNetServer ()
 get the NPL net server
 
ParaEngine::CNPLNetClientGetNetClient ()
 get the Net client implementation. More...
 
void SetHostMainStatesInFrameMove (bool bHostMainStatesInFrameMove)
 whether we will process messages in the main threads in the frame move function. More...
 
- Public Member Functions inherited from ParaEngine::IAttributeFields
virtual int GetChildAttributeColumnCount ()
 we support multi-dimensional child object. More...
 
virtual IAttributeFieldsGetChildAttributeObject (const std::string &sName)
 get attribute by child object. More...
 
 ATTRIBUTE_METHOD1 (IAttributeFields, GetName_s, const char **)
 
 ATTRIBUTE_METHOD1 (IAttributeFields, SetName_s, const char *)
 
 ATTRIBUTE_METHOD (IAttributeFields, PrintObject_s)
 
 ATTRIBUTE_METHOD (IAttributeFields, AddRef_s)
 
 ATTRIBUTE_METHOD1 (IAttributeFields, GetRefCount_s, int *)
 
 ATTRIBUTE_METHOD1 (IAttributeFields, SetTime_s, int)
 
 ATTRIBUTE_METHOD1 (IAttributeFields, GetTime_s, int *)
 
 ATTRIBUTE_METHOD (IAttributeFields, Release_s)
 
virtual const std::string & GetIdentifier ()
 
virtual void SetIdentifier (const std::string &sID)
 
virtual bool IsModified ()
 whether some of the fields are modified.It is up to the implementation class to provide this functionality if necessary. More...
 
virtual void SetModified (bool bModified)
 set whether any field has been modified. More...
 
virtual bool ValidateFields ()
 validate all fields and return true if validation passed. More...
 
virtual string GetValidationMessage ()
 get the recent validation message due to the most recent call to ValidateFields()
 
virtual bool ResetField (int nFieldID)
 Reset the field to its initial or default value. More...
 
virtual bool InvokeEditor (int nFieldID, const std::string &sParameters)
 Invoke an (external) editor for a given field. More...
 
virtual bool AddChildAttributeObject (IAttributeFields *pChild, int nRowIndex=-1, int nColumnIndex=0)
 add child object. More...
 
virtual void * QueryObjectByName (const std::string &sObjectType)
 convert to object of a given type. More...
 
virtual void * QueryObject (int nObjectType)
 convert to object of a given type. More...
 
virtual int GetTime ()
 get the current local time in case it is animated in milli seconds frames. More...
 
virtual void SetTime (int nTime)
 
virtual CDynamicAttributeFieldGetDynamicField (const std::string &sName)
 Get a dynamic field with a given name. More...
 
virtual CDynamicAttributeFieldGetDynamicField (int nIndex)
 Get a dynamic field with a given index. More...
 
virtual const char * GetDynamicFieldNameByIndex (int nIndex)
 get field name by index
 
virtual int GetDynamicFieldCount ()
 how many dynamic field this object currently have. More...
 
virtual int SetDynamicField (const std::string &sName, const CVariable &value)
 set a dynamic field with a given name. More...
 
virtual int AddDynamicField (const std::string &sName, ATTRIBUTE_FIELDTYPE dwType)
 add dynamic field and return field index
 
virtual void RemoveAllDynamicFields ()
 remove all dynamic fields
 
virtual int SaveDynamicFieldsToString (std::string &output)
 save only text dynamic fields to fieldname = value text strings. More...
 
virtual int LoadDynamicFieldsFromString (const std::string &input)
 load only text dynamic fields from string More...
 
CAttributeClassGetAttributeClass ()
 get the main attribute class object. More...
 
void PrintObject ()
 print the content of this object to a text file at temp/doc/[ClassName].txt. More...
 
- Public Member Functions inherited from ParaEngine::IObject
virtual void Clone (IObject *obj) const
 Clone the object's contains to a pointer. More...
 
virtual IObjectClone () const
 Clone the object's contains and return a pointer to the newly created object. More...
 
virtual bool Equals (const IObject *obj) const
 Compare the object with another object. More...
 
virtual const ITypeGetType () const
 
virtual std::string ToString () const
 
WeakPtr_typeGetWeakReference ()
 get weak reference object. More...
 
virtual int ProcessObjectEvent (const ObjectEvent &event)
 this function is only used to backward compatibility of ParaObject:AddEvent() function. More...
 
- Public Member Functions inherited from ParaEngine::CRefCounted
void addref () const
 add reference count of the object. More...
 
bool delref () const
 decrease reference count of the object. More...
 
int GetRefCount () const
 get the reference count
 
virtual int Release ()
 
CRefCountedAddToAutoReleasePool ()
 addref and releases the ownership sometime soon automatically (usually at the end of the current frame). More...
 
- Public Member Functions inherited from NPL::INPLRuntime
virtual void AddPublicFile (const std::string &filename, int nID)=0
 add a nID, filename pair to the public file list. More...
 

Static Public Member Functions

static CNPLRuntimeGetInstance ()
 the singleton instance
 
static void SetDefaultNPLStateType (NPL::NPLRuntimeStateType val)
 if one wants to change the default runtime state, such as using external luastate, one need to call this function before GetInstance(). More...
 
static INPLStimulationPipe * GetNetworkLayerPipe ()
 Get the network layer pipe. More...
 
- Static Public Member Functions inherited from ParaEngine::IAttributeFields
static HRESULT GetAttributeClassID_s (IAttributeFields *cls, int *p1)
 
static HRESULT GetAttributeClassName_s (IAttributeFields *cls, const char **p1)
 
static bool OpenWithDefaultEditor (const char *sFilename, bool bWaitOnReturn=false)
 Open a given file with the default registered editor in the game engine. More...
 

Additional Inherited Members

- Public Types inherited from ParaEngine::IAttributeFields
typedef ParaEngine::weak_ptr< IObject, IAttributeFieldsWeakPtr_type
 
- Public Types inherited from ParaEngine::IObject
typedef ParaEngine::weak_ptr< IObjectWeakPtr_type
 
- Protected Member Functions inherited from ParaEngine::IAttributeFields
virtual CAttributeClassCreateAttributeClass ()
 initialize fields
 
virtual CDynamicAttributesSetGetDynamicAttributes (bool bCreateIfNotExist=false)
 
- Protected Attributes inherited from ParaEngine::IObject
WeakPtr_type m_weak_reference
 
- Protected Attributes inherited from ParaEngine::CRefCounted
int m_refcount
 

Detailed Description

CNPLRuntime is a wrapper of the NPL application programming interface (NPL API).

it is normally used as a singleton class.

Member Function Documentation

§ accept()

void CNPLRuntime::accept ( const char *  tid,
const char *  nid = NULL 
)
virtual

accept a given connection.

The connection will be regarded as authenticated once accepted. [thread safe]

Parameters
tidthe temporary id or NID of the connection to be accepted. usually it is from msg.tid or msg.nid.
nidif this is not nil, tid will be renamed to nid after accepted.

Implements NPL::INPLRuntime.

§ ActivateLocalNow()

int CNPLRuntime::ActivateLocalNow ( const char *  sNeuronFile,
const char *  code = NULL,
int  nLength = 0 
)
virtual

activate immediately for the local file (may be in different thread).

Returns
0 or the last return value from code or neuron file

§ AddStateToMainThread()

bool CNPLRuntime::AddStateToMainThread ( NPLRuntimeState_ptr  runtime_state)

add a given runtime state to the main game thread.

this function is thread safe

§ AddToMainThread()

bool CNPLRuntime::AddToMainThread ( INPLRuntimeState runtime_state)
virtual

add a given runtime state to the main game thread.

this function is thread safe

Implements NPL::INPLRuntime.

§ AppendURLRequest()

bool CNPLRuntime::AppendURLRequest ( ParaEngine::CURLRequestTask pUrlTask,
const char *  sPoolName = NULL 
)
virtual

Append URL request to a pool.

Parameters
pUrlTaskmust be new CURLRequestTask(), the ownership of the task is transfered to the manager. so the caller should never delete the pointer.
sPoolNamethe request pool name. If the pool does not exist, it will be created. If null, the default pool is used.

Implements NPL::INPLRuntime.

§ AsyncDownload()

void CNPLRuntime::AsyncDownload ( const char *  url,
const char *  destFolder,
const char *  callbackScript,
const char *  DownloaderName 
)
virtual

Asynchronously download a file from the url.

Parameters
callbackScriptscript code to be called, a global variable called msg is assigned, as below msg = {DownloadState=""|"complete"|"terminated", totalFileSize=number, currentFileSize=number, PercentDone=number}

Implements NPL::INPLRuntime.

§ CancelDownload()

void CNPLRuntime::CancelDownload ( const char *  DownloaderName)
virtual

cancel all asynchronous downloads that matches a certain downloader name pattern

Parameters
DownloaderName:regularexpression. such as "proc1", "proc1.*", ".*"

Implements NPL::INPLRuntime.

§ ChangeRequestPoolSize()

bool CNPLRuntime::ChangeRequestPoolSize ( const char *  sPoolName,
int  nCount 
)
virtual

There is generally no limit to the number of requests sent.

However, each pool has a specified maximum number of concurrent worker slots. the default number is 1. One can change this number with this function.

Implements NPL::INPLRuntime.

§ ClearPublicFiles()

void CNPLRuntime::ClearPublicFiles ( )
virtual

clear all public files, so that the NPL server will be completely private.

[thread safe]

Implements NPL::INPLRuntime.

§ CloseJabberClient()

bool CNPLRuntime::CloseJabberClient ( const char *  sJID)
virtual

close a given jabber client instance.

Basically, there is no need to close a web service, unless one wants to reopen it with different credentials

Parameters
sJIDsuch as "lixizhi@paraweb3d.com"

Implements NPL::INPLRuntime.

§ CreateJabberClient()

ParaEngine::INPLJabberClient * CNPLRuntime::CreateJabberClient ( const char *  sJID)
virtual

Create a new jabber client instance with the given jabber client ID.

It does not open a connection immediately.

Parameters
sJIDsuch as "lixizhi@paraweb3d.com"

Implements NPL::INPLRuntime.

§ CreateRuntimeState()

NPL::NPLRuntimeState_ptr CNPLRuntime::CreateRuntimeState ( const string &  name,
NPLRuntimeStateType  type_ = NPLRuntimeStateType_NPL 
)

create a new runtime state.

this function is thread safe

Parameters
nameif "", it is an anonymous runtime state. otherwise it should be a unique name.
type_the runtime state type.
Returns
the newly created state is returned. If an runtime state with the same non-empty name already exist, the old one is returned.

§ CreateState()

INPLRuntimeState * CNPLRuntime::CreateState ( const char *  name,
NPLRuntimeStateType  type_ = NPLRuntimeStateType_NPL 
)
virtual

create a new runtime state.

this function is thread safe

Parameters
nameif "", it is an anonymous runtime state. otherwise it should be a unique name.
type_the runtime state type.
Returns
the newly created state is returned. If an runtime state with the same non-empty name already exist, the old one is returned.

Implements NPL::INPLRuntime.

§ DeleteRuntimeState()

bool CNPLRuntime::DeleteRuntimeState ( NPLRuntimeState_ptr  runtime_state)

create a given runtime state.

this function is thread safe

§ DeleteState()

bool CNPLRuntime::DeleteState ( INPLRuntimeState pRuntime_state)
virtual

create a given runtime state.

this function is thread safe

Implements NPL::INPLRuntime.

§ Download()

int CNPLRuntime::Download ( const char *  url,
const char *  destFolder,
const char *  callbackScript,
const char *  DownloaderName 
)
virtual

Synchronous call of the function AsyncDownload().

This function will not return until download is complete or an error occurs. this function is rarely used. AsyncDownload() is used.

Returns
:1 if succeed, 0 if fail

Implements NPL::INPLRuntime.

§ EnableAnsiMode()

void CNPLRuntime::EnableAnsiMode ( bool  bEnable)
virtual

whether the first line of the NPL protocol is in ansi code page.

because NPL protocol is compatible with HTTP protocol in ansi mode, some interception web cache servers may cache request even the port number is not 80, so client side applications are encouraged to disable ansi mode.

§ EnableIdleTimeout()

void CNPLRuntime::EnableIdleTimeout ( bool  bEnable)
virtual

Enable idle timeout.

This is the application level timeout setting. We will create a global timer which examines all send/receive time of all open connections, if a connection is inactive (idle for GetIdleTimeoutPeriod()) we will

  • if IsKeepAliveEnabled() is false, actively close the connection. This is the method used by HTTP, which is the only solution to detect broken connection without sending additional keep alive message.
  • if IsKeepAliveEnabled() is true, send an empty message to the other end (keep alive messages) to more accurately detect dead connections (see SetKeepAlive).

Implements NPL::INPLRuntime.

§ GetAttributeClassID()

virtual int NPL::CNPLRuntime::GetAttributeClassID ( )
inlinevirtual

attribute class ID should be identical, unless one knows how overriding rules work.

Reimplemented from ParaEngine::IAttributeFields.

§ GetChildAttributeObjectCount()

int CNPLRuntime::GetChildAttributeObjectCount ( int  nColumnIndex = 0)
virtual

get the number of child objects (row count) in the given column.

please note different columns can have different row count.

Reimplemented from ParaEngine::IAttributeFields.

§ GetIP()

void CNPLRuntime::GetIP ( const char *  nid,
char *  pOutput 
)
virtual

get the ip address of given NPL connection.

this function is usually called by the server for connected clients.

Parameters
nidnid or tid.
pOutPutit must be at least [256] bytes big, that receives the output.
Returns
: the ip address in dot format. empty string is returned if connection can not be found.

Implements NPL::INPLRuntime.

§ GetJabberClient()

ParaEngine::INPLJabberClient * CNPLRuntime::GetJabberClient ( const char *  sJID)
virtual

get an existing jabber client instance interface by its JID.

If the client is not created using CreateJabberClient() before, function may return NULL.

Parameters
sJIDsuch as "lixizhi@paraweb3d.com"

Implements NPL::INPLRuntime.

§ GetMainRuntimeState()

NPL::NPLRuntimeState_ptr CNPLRuntime::GetMainRuntimeState ( )

get the default (main) runtime state.

§ GetMainState()

INPLRuntimeState * CNPLRuntime::GetMainState ( )
virtual

get the default (main) runtime state.

Implements NPL::INPLRuntime.

§ GetMaxPendingConnections()

int CNPLRuntime::GetMaxPendingConnections ( )
virtual

queue size of the server acceptor's queue.

§ GetNetClient()

ParaEngine::CNPLNetClient* NPL::CNPLRuntime::GetNetClient ( )

get the Net client implementation.

§ GetNetworkLayerPipe()

INPLStimulationPipe * CNPLRuntime::GetNetworkLayerPipe ( )
static

Get the network layer pipe.

Returns
: INPLStimulationPipe* m_pNetPipe

§ GetRuntimeState()

NPL::NPLRuntimeState_ptr CNPLRuntime::GetRuntimeState ( const string &  name)

get a runtime state with an explicit name.

this function is thread safe

Parameters
namethe name of the runtime state. if empty or "main", the main runtime state is returned.

§ GetState()

INPLRuntimeState * CNPLRuntime::GetState ( const char *  name)
virtual

get a runtime state with an explicit name.

this function is thread safe

Parameters
namethe name of the runtime state. if NULL or "main", the main runtime state is returned.

Implements NPL::INPLRuntime.

§ InstallFields()

int CNPLRuntime::InstallFields ( ParaEngine::CAttributeClass pClass,
bool  bOverride 
)
virtual

this class should be implemented if one wants to add new attribute.

This function is always called internally.

Reimplemented from ParaEngine::IAttributeFields.

§ IsServerStarted()

bool NPL::CNPLRuntime::IsServerStarted ( )
virtual

whether the NPL runtime's http server is started.

§ IsTCPKeepAliveEnabled()

bool CNPLRuntime::IsTCPKeepAliveEnabled ( )
virtual

whether SO_KEEPALIVE is enabled.

Returns
bEnable: true to enable.

Implements NPL::INPLRuntime.

§ NPL_accept()

void CNPLRuntime::NPL_accept ( const char *  tid,
const char *  nid = NULL 
)

accept a given connection.

The connection will be regarded as authenticated once accepted. [thread safe]

Parameters
tidthe temporary id or NID of the connection to be accepted. usually it is from msg.tid or msg.nid.
nidif this is not nil, tid will be renamed to nid after accepted.

§ NPL_Activate()

int CNPLRuntime::NPL_Activate ( NPLRuntimeState_ptr  runtime_state,
const char *  sNeuronFile,
const char *  code = NULL,
int  nLength = 0,
int  channel = 0,
int  priority = 2,
int  reliability = 3 
)

activate the specified file.

It can either be local or remote file.

Parameters
pStatethe source runtime state that initiated this activation. If pState is NULL, the main runtime state is used.
sNPLFileNamea globally unique name of a NPL file name instance. The string format of an NPL file name is like below. [(sRuntimeStateName|gl)][sNID:]sRelativePath[]

the following is a list of all valid file name combinations: "user001@paraengine.com:script/hello.lua" – a file of user001 in its default gaming thread "(world1)server001@paraengine.com:script/hello.lua" – a file of server001 in its thread world1 "(worker1)script/hello.lua" – a local file in the thread worker1 "(gl)script/hello.lua" – a glia (local) file in the current runtime state's thread "script/hello.lua" – a file in the current thread. For a single threaded application, this is usually enough.

Parameters
codeit is a chunk of pure data table init code that would be transmitted to the destination file.
nLengththe code length. if this is 0, length is determined from code by finding '\0', but, it must not exceed 4096 bytes. If length is explicitly specified, there is no such a limit.
channel:Onwhich channel to send the package. It can be a number in [0,15]. In case it is nil, the default channel (0) is used.
priorityFrom high to low.If this is nil, medium priority(0) is used. following enumerations are used to describe when packets are delivered. enum PacketPriority { SYSTEM_PRIORITY, /// internally Used to send above-high priority messages. HIGH_PRIORITY, /// High priority messages are send before medium priority messages. MEDIUM_PRIORITY, /// Medium priority messages are send before low priority messages. LOW_PRIORITY, /// Low priority messages are only sent when no other messages are waiting. };
reliability:Fromunreliable to reliable sequenced. 0 stands for unreliable. If this is nil, RELIABLE_ORDERED(3) is used. following enumerations are used to describe how packets are delivered. enum PacketReliability { UNRELIABLE, /// Same as regular UDP, except that it will also discard duplicate datagrams. It adds (6 to 17) + 21 bits of overhead, 16 of which is used to detect duplicate packets and 6 to 17 of which is used for message length. UNRELIABLE_SEQUENCED, /// Regular UDP with a sequence counter. Out of order messages will be discarded. This adds an additional 13 bits on top what is used for UNRELIABLE. RELIABLE, /// The message is sent reliably, but not necessarily in any order. Same overhead as UNRELIABLE. RELIABLE_ORDERED, /// This message is reliable and will arrive in the order you sent it. Messages will be delayed while waiting for out of order messages. Same overhead as UNRELIABLE_SEQUENCED. RELIABLE_SEQUENCED /// This message is reliable and will arrive in the sequence you sent it. Out or order messages will be dropped. Same overhead as UNRELIABLE_SEQUENCED. };
Note
: pure data table is defined as table consisting of only string, number and other table of the above type. NPL.activate function also accepts ParaFileObject typed message data type. ParaFileObject will be converted to base64 string upon transmission. There are size limit though of 10MB. one can also programmatically check whether a script object is pure date by calling NPL.SerializeToSCode() function. Please note that data types that is not pure data in sCode will be ignored instead of reporting an error.

§ NPL_AddDNSRecord()

void CNPLRuntime::NPL_AddDNSRecord ( const char *  sDNSName,
const char *  sAddress 
)
virtual

add a DNS server record to the current NPL runtime.

DNS server record is a mapping from name to (IP:port) if one maps several IP:port to the same name, the former ones will be overridden.

Parameters
sDNSNamethe DNS server name. the DNS name "_world" is used for the current world DNS server. It is commonly used as a DNS reference to the current world that the user is exploring.
sAddress"IP:port". e.g. "192.168.1.10:4000"

TODO: add security: we cannot allow every one to change this as they wish. The user must be informed before this can be changed.

Implements NPL::INPLRuntime.

§ NPL_AddPublicFile()

void CNPLRuntime::NPL_AddPublicFile ( const string &  filename,
int  nID 
)

add a nID, filename pair to the public file list.

we only allow remote NPL runtime to activate files in the public file list. Each public file has a user defined ID. The NPL network layer always try to use its ID for transmission to minimize bandwidth. There are some negotiations between sender and receiver to sync the string to ID map before they use it. [thread safe]

Parameters
nIDthe integer to encode the string. it is usually small and positive number.
sStringthe string for the id. if input is empty, it means removing the mapping of nID.

§ NPL_ChangeTimer()

bool CNPLRuntime::NPL_ChangeTimer ( NPLRuntimeState_ptr  runtime_state,
int  nIDEvent,
int  dueTime,
int  period 
)

Changes the start time and the interval between method invocations for a timer, using 32-bit signed integers to measure time intervals.

[thread safe]

Parameters
runtime_statein which runtime state the timer is. Timer ID is unique only within a given runtime state.
nIDEventSpecifies the timer to be destroyed.For nIDEvent<=0, they are reserved for internal uses can not be killed by this function. This value must be the same as the nIDEvent value passed to the SetTimer function that created the timer.
dueTimeThe amount of time to delay before the invoking the callback method specified when the Timer was constructed, in milliseconds. Specify zero (0) to restart the timer immediately. however, the current implementation does not accept dueTime that is larger than MAX_TIMER_DUE_TIME 10000000, which is 10000 seconds.
period:Thetime interval between invocations of the callback method specified when the Timer was constructed, in milliseconds.
Returns
: If the function succeeds, the return value is true

§ NPL_ClearPublicFiles()

void CNPLRuntime::NPL_ClearPublicFiles ( )

clear all public files, so that the NPL server will be completely private.

[thread safe]

§ NPL_EnableNetwork()

void CNPLRuntime::NPL_EnableNetwork ( bool  bEnable,
const char *  CenterName,
const char *  password 
)

OBSOLETED: Enable the network, by default the network layer is disabled.

calling this function multiple time with different CenterName will restart the network layer with a different center name.

Parameters
bEnabletrue to enable, false to disable.If this is false, the CenterName and Password are ignored.
CenterNamethe local nerve center name. it is also the user name which local receptor will use in the credentials to login in other NPL runtime.
Password
Returns
true if succeeded.

§ NPL_GetChannelProperty()

void CNPLRuntime::NPL_GetChannelProperty ( int  channel_ID,
int *  priority,
int *  reliability 
)
virtual

see also NPL_SetChannelProperty

Parameters
channel_ID
priority[out]
reliability[out]

Implements NPL::INPLRuntime.

§ NPL_GetDefaultChannel()

int CNPLRuntime::NPL_GetDefaultChannel ( )
virtual

Get the default channel ID, default value is 0.

Default channel is used when NPL.activate() call¡¯s does not contain the channel property.

Returns
channel_ID It can be a number in [0,15].default is 0

Implements NPL::INPLRuntime.

§ NPL_GetIP()

string CNPLRuntime::NPL_GetIP ( const char *  nid)

get the ip address of given NPL connection.

this function is usually called by the server for connected clients.

Parameters
nidnid or tid.
Returns
: the ip address in dot format. empty string is returned if connection can not be found.

§ NPL_GetSourceName()

const string & CNPLRuntime::NPL_GetSourceName ( )

get the current activation's source name.

Each NPL activation has a source name which started the activation. This is usually "" for local activation and some kind of "name@server" for network activation.

§ NPL_KillTimer()

bool CNPLRuntime::NPL_KillTimer ( NPLRuntimeState_ptr  runtime_state,
int  nIDEvent 
)

Destroys the specified timer [thread safe].

Parameters
runtime_statein which runtime state the timer is. Timer ID is unique only within a given runtime state.
nIDEventSpecifies the timer to be destroyed.For nIDEvent<=0, they are reserved for internal uses can not be killed by this function. This value must be the same as the nIDEvent value passed to the SetTimer function that created the timer.
Returns
: If the function succeeds, the return value is true

§ NPL_LoadFile()

void CNPLRuntime::NPL_LoadFile ( NPLRuntimeState_ptr  runtime_state,
const char *  filePath,
bool  bReload 
)

load a file (in the specified runtime state) without running it.

If the file is already loaded, it will not be loaded again unless bReload is true. IMPORTANT: this function is synchronous; unlike the asynchronous activation function. LoadFile is more like "include in C++".When the function returns, contents in the file is loaded to memory. For source file: when loading an NPL file, we will first find if there is an up to date compiled version in the bin directory. if there is, we will load the compiled version, otherwise we will use the text version. use bin version, if source version does not exist; use bin version, if source and bin versions are both on disk (instead of zip) and that bin version is newer than the source version. e.g. we can compile source to bin directory with file extension ".o", e.g. "script/abc.lua" can be compiled to "bin/script/abc.o", The latter will be used if available and up-to-date.

Note
: This function must be called in the same thread that hosts the specified runtime state (pState).
Parameters
pStateIn which runtime state to load the file. If pState is NULL, the main runtime state is used.
filePaththe local relative file path. If the file extension is ".dll", it will be treated as a plug-in. if the filepath is "*.dll", it means all DLLs in that directory.
bReloadif true, the file will be reloaded even if it is already loaded. otherwise, the file will only be loaded if it is not loaded yet.
Remarks
: one should be very careful when calling with bReload set to true, since this may lead to recursive reloading of the same file. If this occurs, it will generate C Stack overflow error message.

§ NPL_RegisterWSCallBack()

void CNPLRuntime::NPL_RegisterWSCallBack ( const char *  sWebServiceFile,
const char *  sCode 
)

this method will associate a web service (method) with either a sCode, which will be called when the web service returned.

The returned message, if any, will be passed via a global parameter called msg. For example: Function callbackFunc1() If(msg.username~=nil) then end End NPL.RegisterWSCallBack("http://paraengine.com/login.aspx",callbackFunc1); NPL.activate("http://paraengine.com/login.aspx", {username=¡±lxz¡±});

Parameters
sWebServiceFileURL of the web service
sCodecode to be executed when the web service is called. When a two-way web service call is invoked; it internally will create a thread for the returning message. Please refer to .Net 3.0 network communication architecture.

§ NPL_reject()

void CNPLRuntime::NPL_reject ( const char *  nid,
int  nReason = 0 
)

reject and close a given connection.

The connection will be closed once rejected. [thread safe]

Parameters
nidthe temporary id or NID of the connection to be rejected. usually it is from msg.tid or msg.nid.
nReasondefault to 0.
  • 0 or positive value is forcibly reset/disconnect (it will abort pending read/write immediately).
  • 1 is another user with same nid is authenticated. The server should send a message to tell the client about this.
  • -1 or negative value means gracefully close the connection when all pending data has been sent.

§ NPL_ResetChannelProperties()

void CNPLRuntime::NPL_ResetChannelProperties ( )
virtual

reset all 16 predefined channel properties.

according to table1. Default NPL channel properties. see also NPL_SetChannelProperty The following table shows the default NPL channel properties. It is advised for users to stick to this default mapping when developing their own applications. Table 1. Default NPL channel properties channel_ID Priority Reliability Usage 0 med RELIABLE_ORDERED System message 1 med UNRELIABLE_SEQUENCED Character positions 2 med RELIABLE_ORDERED Large Simulation Object transmission, such as terrain height field. 4 med RELIABLE_ORDERED Chat message 14 med RELIABLE files transmission and advertisement 15 med RELIABLE_SEQUENCED Voice transmission 11-15 med RELIABLE_ORDERED

Implements NPL::INPLRuntime.

§ NPL_SetChannelProperty()

void CNPLRuntime::NPL_SetChannelProperty ( int  channel_ID,
int  priority,
int  reliability 
)
virtual

Messages can be sent via predefined channels.

There are 16 channels from 0 to 15 to be used. 0 is the default channel. This method sets the channel property for a given channel. The default channel property is given in table. The following table shows the default NPL channel properties. It is advised for users to stick to this default mapping when developing their own applications. Table 1. Default NPL channel properties channel_ID Priority Reliability Usage 0 med RELIABLE_ORDERED System message 1 med UNRELIABLE_SEQUENCED Character positions 2 med RELIABLE_ORDERED Large Simulation Object transmission, such as terrain height field. 4 med RELIABLE_ORDERED Chat message 14 med RELIABLE files transmission and advertisement 15 med RELIABLE_SEQUENCED Voice transmission 11-15 med RELIABLE_ORDERED

Parameters
channel_ID
priority
reliability

Implements NPL::INPLRuntime.

§ NPL_SetDefaultChannel()

void CNPLRuntime::NPL_SetDefaultChannel ( int  channel_ID)
virtual

Set the default channel ID, default value is 0.

Default channel is used when NPL.activate() call¡¯s does not contain the channel property.

Parameters
channel_IDIt can be a number in [0,15].default is 0

Implements NPL::INPLRuntime.

§ NPL_SetProtocol()

void CNPLRuntime::NPL_SetProtocol ( const char *  nid,
int  protocolType = 0 
)

set transmission protocol, default value is 0.

§ NPL_SetSourceName()

void CNPLRuntime::NPL_SetSourceName ( const char *  sName)

Set the current activation's source name.

Each NPL activation has a source name which started the activation. This function is called automatically when a new activation occurs.So only call this function if one wants to override the old one for special code logics.

Parameters
sNameThis is usually "" for local activation and some kind of "name@server" for network activation.

§ NPL_SetTimer()

bool CNPLRuntime::NPL_SetTimer ( NPLRuntimeState_ptr  runtime_state,
int  nIDEvent,
float  fElapse,
const char *  sNeuronFile 
)

creates a timer with the specified time-out value [thread safe]

Parameters
runtime_statein which runtime state the timer is. Timer ID is unique only within a given runtime state.
nIDEventSpecifies a positive timer identifier. For nIDEvent<=0, they are reserved for internal uses. If the NPL runtime already has a timer with the value nIDEvent, then the existing timer is replaced by the new timer. When SetTimer replaces a timer, the timer is reset.
fElapseSpecifies the time-out value, in seconds. Please note that a timer will not be repeatedly activated if its timeout is shorter than the frame rate of the NPL simulation pipeline .
sNeuronFileThe NPL file to be activated when the time-out value elapses. For more information about the file name See NPL.activate().
Returns
: true if succeeds.An application can pass the value of the nIDEvent parameter to the NPL.KillTimer function to destroy the timer.

§ NPL_StartNetServer()

void CNPLRuntime::NPL_StartNetServer ( const char *  server = NULL,
const char *  port = NULL 
)

start the NPL net server's io_service loop.

This function returns immediately. it will spawn the accept and dispatcher thread. call this function only once per process.

Parameters
serverdefault to "127.0.0.1"
portdefault to "60001"

§ NPL_UnregisterWSCallBack()

void CNPLRuntime::NPL_UnregisterWSCallBack ( const char *  sWebServiceFile)

unregister web service call back for a given file.

Parameters
sWebServiceFileif this is nil or "", all call backs will be unregistered.

§ reject()

void CNPLRuntime::reject ( const char *  nid,
int  nReason = 0 
)
virtual

reject and close a given connection.

The connection will be closed once rejected. [thread safe]

Parameters
nidthe temporary id or NID of the connection to be rejected. usually it is from msg.tid or msg.nid.
nReasondefault to 0. if 1 it means connection overriden

Implements NPL::INPLRuntime.

§ RemoveStateFromMainThread()

bool CNPLRuntime::RemoveStateFromMainThread ( NPLRuntimeState_ptr  runtime_state)

remove a given runtime state from the main game thread.

this function is thread safe

§ Run()

void CNPLRuntime::Run ( bool  bToEnd = true)
virtual

call this function regularly, to process packages.

Parameters
bToEndif true, the function will only return when there is no more input packages in the queue

dispatch events in NPL.

activate all timers

process results from NPL web service client

Implements NPL::INPLRuntime.

§ SetCompressionKey()

void CNPLRuntime::SetCompressionKey ( const byte *  sKey = 0,
int  nSize = 0,
int  nUsePlainTextEncoding = 0 
)
virtual

set the compression method of incoming the outgoing messages.

If this is not called, the default internal key is used for message encoding. [Not Thread Safe]: one must call this function before sending or receiving any encoded messages. so it is usually called when the game engine starts.

Parameters
sKeythe byte array of key. the generic key that is used for encoding/decoding
nSizesize in bytes of the sKey. default is 64 bytes
nUsePlainTextEncodingdefault to 0. if 0, the key is used as it is. if 1, the input key will be modified so that the encoded message looks like plain text(this can be useful to pass some firewalls). if -1, the input key will be modified so that the encoded message is binary.

Implements NPL::INPLRuntime.

§ SetCompressionLevel()

void CNPLRuntime::SetCompressionLevel ( int  nLevel)
virtual

Set the zlib compression level to use in case compression is enabled.

default to 0, which means no compression. Compression level, which is an integer in the range of -1 to 9. Lower compression levels result in faster execution, but less compression. Higher levels result in greater compression, but slower execution. The zlib constant Z_DEFAULT_COMPRESSION, equal to -1, provides a good compromise between compression and speed and is equivalent to level 6. Level 0 actually does no compression at all, and in fact expands the data slightly to produce the zlib format (it is not a byte-for-byte copy of the input).

Implements NPL::INPLRuntime.

§ SetCompressionThreshold()

void CNPLRuntime::SetCompressionThreshold ( int  nThreshold)
virtual

set the default compression threshold for all connections on this machine.

when the message size is bigger than this number of bytes, we will use m_nCompressionLevel for compression. For message smaller than the threshold, we will not compress even m_nCompressionLevel is not 0.

Implements NPL::INPLRuntime.

§ SetDefaultNPLStateType()

void CNPLRuntime::SetDefaultNPLStateType ( NPL::NPLRuntimeStateType  val)
static

if one wants to change the default runtime state, such as using external luastate, one need to call this function before GetInstance().

§ SetHostMainStatesInFrameMove()

void CNPLRuntime::SetHostMainStatesInFrameMove ( bool  bHostMainStatesInFrameMove)
virtual

whether we will process messages in the main threads in the frame move function.

It is default to true; However, it is possible for server to set to false, if one wants to have a more responsive main state on the server. For example, it does high-frequency dispatcher jobs, instead of monitoring. But client application, it is only advised to set to true, otherwise the scripting and render modules will be run in different threads, leading to complexity and bugs. : One can only call this function once to set to false. This function is only used by the ParaEngineServer

Implements NPL::INPLRuntime.

§ SetIdleTimeoutPeriod()

void CNPLRuntime::SetIdleTimeoutPeriod ( int  nMilliseconds)
virtual

how many milliseconds of inactivity to assume this connection should be timed out.

if 0 it is never timed out.

Implements NPL::INPLRuntime.

§ SetKeepAlive()

void CNPLRuntime::SetKeepAlive ( bool  bEnable)
virtual

enable application level keep alive.

we will use a global idle timer to detect if a connection has been inactive for GetIdleTimeoutPeriod(), if so, we may send the keep alive message.

Parameters
bEnableenable keep alive will automatically enable EnableIdleTimeout()

Implements NPL::INPLRuntime.

§ SetTCPKeepAlive()

void CNPLRuntime::SetTCPKeepAlive ( bool  bEnable)
virtual

System level Enable/disable SO_KEEPALIVE.

one needs set following values in linux procfs or windows registry in order to work as expected.

  • tcp_keepalive_intvl (integer; default: 75) The number of seconds between TCP keep-alive probes.
  • tcp_keepalive_probes (integer; default: 9) The maximum number of TCP keep-alive probes to send before giving up and killing the connection if no response is obtained from the other end.
  • tcp_keepalive_time (integer; default: 7200) The number of seconds a connection needs to be idle before TCP begins sending out keep-alive probes. Keep-alives are only sent when the SO_KEEPALIVE socket option is enabled. The default value is 7200 seconds (2 hours). An idle connection is terminated after approximately an additional 11 minutes (9 probes an interval of 75 seconds apart) when keep-alive is enabled. Note that underlying connection tracking mechanisms and application timeouts may be much shorter. Use the default system level TCP keep alive setting for this socket. Please see TCP keep alive for more information. It can be used to solve the "half-open connection". it is arguable whether to use protocol level keep alive or implement it in the application level.
    Parameters
    bEnabletrue to enable.

Implements NPL::INPLRuntime.

§ SetUseCompression()

void CNPLRuntime::SetUseCompression ( bool  bCompressIncoming,
bool  bCompressOutgoing 
)
virtual

whether to use compression on transport layer for incoming and outgoing connections

Parameters
bCompressIncomingif true, compression is used for all incoming connections. default to false.
bCompressIncomingif true, compression is used for all outgoing connections. default to false.

Implements NPL::INPLRuntime.

§ StartNetServer()

void CNPLRuntime::StartNetServer ( const char *  server = NULL,
const char *  port = NULL 
)
virtual

start the NPL net server's io_service loop.

This function returns immediately. it will spawn the accept and dispatcher thread. call this function only once per process.

Parameters
serverdefault to "127.0.0.1"
portdefault to "60001"

Implements NPL::INPLRuntime.


The documentation for this class was generated from the following files: