Purpose: Initialize a listening socket.
| Return Type | Function name | Arguments |
|---|---|---|
| hzEcode | hzIpListen::InitUNIX | (hzIpServer*,hzTcpCode(*)(hzChain&,hzIpConnex*),hzTcpCode(*)(hzIpConnex*),hzTcpCode(*)(hzIpConnex*),const char*,uint32_t,uint32_t,uint32_t,) |
Declared in file: hzIpServer.h
Defined in file : hzIpServer.cpp
Function Logic:
Function body:
hzEcode hzIpListen::InitUNIX (hzIpServer* pServer)hzTcpCode(*)(hzChain&,hzIpConnex*) OnIngress, hzTcpCode(*)(hzIpConnex*) OnConnect, hzTcpCode(*)(hzIpConnex*) OnDisconn, const char* sockFile, uint32_t nTimeout, 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) sockFile UNIX socket file name
// 6) nMaxConn Max number of simulataneous connections to this port.
// 7) bOpFlags Options are STREAM or DGRAM
//
// 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::InitUNIX") ;
if (!pServer) return hzerr(E_ARGUMENT, "No hzIpServer supplied") ;
if (!OnIngress) return hzerr(E_ARGUMENT, "No OnIngress function supplied") ;
if (!sockFile || !sockFile[0])
return hzerr(E_ARGUMENT, "No UNIX socket file supplied") ;
m_pServer = pServer ;
if (OnIngress) m_OnIngress = OnIngress ;
if (OnConnect) m_OnConnect = OnConnect ;
if (OnDisconn) m_OnDisconn = OnDisconn ;
m_nTimeout = nTimeout ;
m_nMaxConn = nMaxConn ;
if (bOpflags & HZ_LISTEN_SECURE)
hzwarn(E_ARGUMENT, "UNIX Sockets do not use SSL") ;
m_SockFile = sockFile ;
m_bOpflags = bOpflags ;
return E_OK ;
}