initial commit
This commit is contained in:
35
mw/tcpserver/mw_tcpserver.h
Executable file
35
mw/tcpserver/mw_tcpserver.h
Executable file
@@ -0,0 +1,35 @@
|
||||
#ifndef __MW_TCPSERVER__
|
||||
#define __MW_TCPSERVER__
|
||||
#include <stdint.h>
|
||||
#include "list.h"
|
||||
#include "kpacket.h"
|
||||
#include "json_packet.h"
|
||||
#include "hloop.h"
|
||||
#include "hbase.h"
|
||||
#include "hthread.h"
|
||||
|
||||
|
||||
|
||||
|
||||
typedef struct tcpserver{
|
||||
int8_t status;// 'I' idle(initial), 'R' running, 'E' exit
|
||||
hloop_t *loop;
|
||||
int16_t stack_size;
|
||||
iobuffer read_iobuf;
|
||||
hthread_t th;
|
||||
hio_t *hio; /*连接的hio, 如果多个则自动选择, 最快那个*/
|
||||
}tcpserver;
|
||||
|
||||
|
||||
tcpserver *tcpserver_init(int stack_size);
|
||||
|
||||
/**
|
||||
* 支持多个连接同时发起, 最快连接上的会close掉后面连接的
|
||||
**/
|
||||
int32_t tcpserver_deinit(tcpserver *tclient);
|
||||
|
||||
|
||||
void tcpserver_test();
|
||||
|
||||
|
||||
#endif /* __MW_TCPSERVER__ */
|
||||
Reference in New Issue
Block a user