int main(void)
{
	
	TcpServer ts;
	ts.start();
	
	return 0;
}
示例#2
0
API_EXPORT int API_CALL initRtspServer(unsigned short port) {
	s_pRtspSrv.reset(new TcpServer<RtspSession>());
	try {
		s_pRtspSrv->start(port);
		return 0;
	} catch (std::exception &ex) {
		s_pRtspSrv.reset();
		WarnL << ex.what();
		return -1;
	}
}
示例#3
0
int main()
{
    Log::rootLog().setLevel(Log::ERROR);
    
    TcpServer s;
    
    s.setRunCallback(std::bind(&onServerRun, _1));
    
    HttpServer httpd(&s);

    httpd.setHttpCallback("/", std::bind(&onHandler, _1, _2));

    httpd.listen(Address(11181));

    s.start(8);

    return 0; 
}
int main(void) {
	// create logger
	if (SysLogger::inst()->set("../logs/server_log.txt")) {
		return -1;
	}
	SysLogger::inst()->wellcome();

	TcpServer *ts = new TcpServer();

	if (ts->server_init()) {
		goto ERR;
	}
	
	if (ts->start()) {
		goto ERR;
	}

	return 0;

ERR:
	delete ts;
	return -1;
}
示例#5
0
void WordQueryServer::start()
{
	_pool.start();
	_tcpServer.start();
}