调用位置
//(4)一些初始化函数,准备放这里
if(ngx_init_signals() != 0) //信号初始化
{
exitcode = 1;
goto lblexit;
}
if(g_socekt.Initialize() == false)//初始化socket
{
exitcode = 1;
goto lblexit;
}
ngx_c_socket.cxx
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h> //uintptr_t
#include <stdarg.h> //va_start....
#include <unistd.h> //STDERR_FILENO等
#include <sys/time.h> //gettimeofday
#include <time.h> //localtime_r
#include <fcntl.h> //open
#include <errno.h> //errno
#include <sys/socket.h>
#include <sys/ioctl.h> //ioctl
#include <arpa/inet.h>
#include "ngx_c_conf.h"
#include "ngx_macro.h"
#include "ngx_global.h"
#include "ngx_func.h"
#include "ngx_c_socket.h"
//构造函数
CSocekt::CSocekt()
{
m_ListenPortCount = 1; //监听一个端口