예제 #1
0
void QxThread::run()
{
    m_bIsRunning = true;
    while (m_bIsRunning)
    {
        while (m_iSocketDescriptor == 0) {
            if (! m_bIsRunning) {
                return;
            }
            msleep(5);
        }
        QTcpSocket socket;
        doProcess(socket);
        socket.disconnectFromHost();
        if (socket.state() != QAbstractSocket::UnconnectedState)
        {
            socket.waitForDisconnected(QxConnect::getSingleton()->getMaxWait());
        }
        clearData();
        if (m_pThreadPool) {
            m_pThreadPool->setAvailable(this);
        }
    }
}
예제 #2
0
Poco::JSON::Object::Ptr AbstractPlugin::process(Poco::JSON::Object::Ptr const& obj) const
{
    return doProcess(obj);
}
예제 #3
0
int doUnbind(KS_YKT_Clt &ykt_clt,Message &msg)
{
	return doProcess("D",ykt_clt,msg);
}
예제 #4
0
int main()
{
 //   int ret = 0;
	printf("\naaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n");
	
	
	bool flag = false;
	int childpid = 0;
	char *inifile = "transconfig.ini";
	CTcpSocket tcpsocket ;
	CTcpSocket sockettmp ;
	
	openlog("yktbank_gateway",LOG_PID|LOG_CONS|LOG_NDELAY,LOG_LOCAL3);
	
	if( !ReadIni(inifile))
	{
	    printf("读取配置文件[%s]失败\n",inifile);
	    return -1;
	}
	
	writelog(LOG_DEBUG,"drtp_ip[%s],drtp_port[%d],mainfuncno[%d],list_port[%d]",g_para.drtp_ip, g_para.drtp_port, g_para.main_funcno,g_para.bank_lisnport);
	printf("\n drtp_ip[%s],drtp_port[%d],mainfuncno[%d],list_port[%d]\n",g_para.drtp_ip, g_para.drtp_port, g_para.main_funcno,g_para.bank_lisnport);
	if(!KS_YKT_Clt::Initialize(g_para.drtp_ip, g_para.drtp_port, g_para.main_funcno))
	{
		printf("----------初始化通讯平台失败----------\n");
		return 	-1;
	}
		
	signal(SIGCHLD,SIG_IGN);
	signal(SIGINT,SIG_DFL);
	flag = tcpsocket.Create();
	if(!flag)
		exit(1);
	flag = tcpsocket.Listen(g_para.bank_lisnport);
	if(!flag)
		exit(1);
	while(1)
	{
			flag = tcpsocket.Accept(sockettmp);
			
			if(!flag)
				continue;
			if ((childpid = fork()) == 0)		/* 子进程 */
			{   
				tcpsocket.Close();  
				
				doProcess(sockettmp);     /* 处理请求 */  
				
				sockettmp.Close();
				exit(0);  
			}  
			else if(childpid < 0)
			{
                		printf("创建子进程失败\n");
			}
			sockettmp.Close(); 		/* 父进程 */  
	}
	tcpsocket.Close();
	KS_YKT_Clt::Uninitialize();
	closelog();
	return 0;
}