-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.h
More file actions
23 lines (22 loc) · 755 Bytes
/
server.h
File metadata and controls
23 lines (22 loc) · 755 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/*************************************************************************
> File Name: server.h
> Author: MidCHeck
> Mail: midcheck@foxmail.com
> Created Time: 2019年06月08日 星期六 00时46分50秒
************************************************************************/
#ifndef MIDCHECK_SERVER_H
#define MIDCHECK_SERVER_H
#include "socket.h"
namespace MidCHeck{
class Server: public Socket{
public:
Server(const char* ip, int port):Socket(ip, port){
if(bind(this->sock, (struct sockaddr*)&this->sock_addr, sizeof(struct sockaddr_in)) == SOCKET_ERROR) mcthrow("bind失败!");
if(listen(this->sock, 10) == SOCKET_ERROR) mcthrow("listen失败!");
}
~Server(){
this->~Socket();
}
};
} //命名空间MidCHeck结束
#endif