Purpose: Initialize a listening socket.
| Return Type | Function name | Arguments |
|---|---|---|
| hzEcode | hzIpListen::InitINET | (hzIpServer*,hzTcpCode(*)(hzChain&,hzIpConnex*),hzTcpCode(*)(hzIpConnex*),hzTcpCode(*)(hzIpConnex*),uint32_t,uint32_t,uint32_t,uint32_t,) |
Declared in file: hzIpServer.h
Defined in file : hzIpServer.cpp
Function Logic:
Function body:
hzEcode hzIpListen::InitINET (hzIpServer* pServer)hzTcpCode(*)(hzChain&,hzIpConnex*) OnIngress, hzTcpCode(*)(hzIpConnex*) OnConnect, hzTcpCode(*)(hzIpConnex*) OnDisconn, uint32_t nTimeout, uint32_t nPort, uint32_t nMaxConn, uint32_t bOpflags,
{
// Purpose: Initialize a listening socket.
//
// Arguments: 1) pServer The IP Server instance
// 2) OnIngress The Application Specific 'OnIngress' function - called each time client sends in data.
// 3) OnConnect The Application Specific 'Server Hello' function - only where protocol requires server to speak first.
// 4) OnSession Application Specific Session Handler function - only where client sessions are handled in a separate thread.
// 5) nTimeout Timeout in seconds.
// 6) nPort The port number to listen on.
// 7) nMaxConn Max number of simulataneous connections to this port.
// 8) bSecure Use SSL
//
// Returns: E_NOINIT If the SSL server method is not set up (SSL applications only)
// E_OK If the listening socket is set up.
_hzfunc("hzIpListen::InitINET") ;
if (!pServer) return hzerr(E_ARGUMENT, "No hzIpServer supplied") ;
if (!OnIngress) return hzerr(E_ARGUMENT, "No OnIngress function supplied") ;
m_pServer = pServer ;
// m_pLog = pServer->
if (OnIngress) m_OnIngress = OnIngress ;
if (OnConnect) m_OnConnect = OnConnect ;
if (OnDisconn) m_OnDisconn = OnDisconn ;
m_nTimeout = nTimeout ;
m_nPort = nPort ;
m_nMaxConn = nMaxConn ;
if (bOpflags & HZ_LISTEN_SECURE)
{
if (!s_svrMeth)
{
hzerr(E_NOINIT, "No SSL initialization") ;
return E_NOINIT ;
}
}
m_bOpflags = bOpflags ;
return E_OK ;
}