|
My Project
|
Current NPL configuration settings. More...
#include <NPLNetServer.h>
Public Member Functions | |
| void | start (const char *server=NULL, const char *port=NULL) |
| start the server's io_service loop. More... | |
| void | stop () |
| Stop the server. | |
| void | Cleanup () |
| clean up all resources | |
| CNPLDispatcher & | GetDispatcher () |
| NPLDispatcher serves as an interface between the low level socket interface and NPL message queues. | |
| CNPLConnectionManager & | GetConnectionManager () |
| get the connection object in this server | |
| NPLConnection_ptr | CreateConnection (NPLRuntimeAddress_ptr pAddress) |
| Create a new connection with a remote server and immediately connect and start the connection. More... | |
| void | SetTCPKeepAlive (bool bEnable) |
| System level Enable/disable SO_KEEPALIVE. More... | |
| bool | IsTCPKeepAliveEnabled () |
| whether SO_KEEPALIVE is enabled. More... | |
| void | SetKeepAlive (bool bEnable) |
| enable application level keep alive. More... | |
| bool | IsKeepAliveEnabled () |
| void | EnableIdleTimeout (bool bEnable) |
| Enable idle timeout. More... | |
| bool | IsIdleTimeoutEnabled () |
| void | SetIdleTimeoutPeriod (int nMilliseconds) |
| how many milliseconds of inactivity to assume this connection should be timed out. More... | |
| int | GetIdleTimeoutPeriod () |
| void | EnableAnsiMode (bool bEnable) |
| whether the first line of the NPL protocol is in ansi code page. More... | |
| bool | IsAnsiMode () |
| int | GetMaxPendingConnections () const |
| queue size of the acceptor's queue. More... | |
| void | SetMaxPendingConnections (int val) |
| std::string | GetExternalIP () |
| get extern IP address of this computer. More... | |
| 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... | |
| NPL::NPLConnection_ptr NPL::CNPLNetServer::CreateConnection | ( | NPLRuntimeAddress_ptr | pAddress | ) |
Create a new connection with a remote server and immediately connect and start the connection.
[Thread Safe]
| pAddress | the target NPL runtime address to connect to. |
| void NPL::CNPLNetServer::EnableAnsiMode | ( | bool | bEnable | ) |
| void NPL::CNPLNetServer::EnableIdleTimeout | ( | bool | bEnable | ) |
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
| std::string NPL::CNPLNetServer::GetExternalIP | ( | ) |
get extern IP address of this computer.
| int NPL::CNPLNetServer::GetMaxPendingConnections | ( | ) | const |
queue size of the acceptor's queue.
|
virtual |
whether the NPL runtime's http server is started.
| bool NPL::CNPLNetServer::IsTCPKeepAliveEnabled | ( | ) |
whether SO_KEEPALIVE is enabled.
| void NPL::CNPLNetServer::SetIdleTimeoutPeriod | ( | int | nMilliseconds | ) |
how many milliseconds of inactivity to assume this connection should be timed out.
if 0 it is never timed out.
| void NPL::CNPLNetServer::SetKeepAlive | ( | bool | bEnable | ) |
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.
| bEnable | enable keep alive will automatically enable EnableIdleTimeout() |
| void NPL::CNPLNetServer::SetTCPKeepAlive | ( | bool | bEnable | ) |
System level Enable/disable SO_KEEPALIVE.
one needs set following values in linux procfs or windows registry in order to work as expected.
| bEnable | true to enable. |
| void NPL::CNPLNetServer::start | ( | const char * | server = NULL, |
| const char * | port = NULL |
||
| ) |
start the server's io_service loop.
This function returns immediately. it will spawn the accept and dispatcher thread.
| server | default to "127.0.0.1" |
| port | default to "60001" |
1.8.12