-
Notifications
You must be signed in to change notification settings - Fork 0
/
t_main.cpp
44 lines (38 loc) · 821 Bytes
/
t_main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/**
* @file: t_main.cpp
* @brief:
* tcp 服务的入口
* @author: wusheng Hu
* @version: v0x0001
* @date: 2018-04-24
*/
#include <iostream>
#include <stdlib.h>
#include "t_tcpsrv.hpp"
using namespace std;
using namespace T_TCP;
int main(int argc, char **argv)
{
if (argc < 4)
{
std::cout << argv[0] << " ip port thread_num" << std::endl;
return 0;
}
string sIp(argv[1]);
int iPort = ::atoi(argv[2]);
int iRunThreadNums = ::atoi(argv[3]);
if (iRunThreadNums <= 0)
{
iRunThreadNums = 3;
}
TcpSrv tcpSrv(sIp, iPort, iRunThreadNums);
if (tcpSrv.Run() == false)
{
std::cout << "run tcp routine fail" << std::endl;
}
else
{
std::cout << "tcp main routine exit " << std::endl;
}
return 0;
}