1 Star 0 Fork 24

albert/socket

forked from eclipser/socket 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
ServerSocket.h 1.52 KB
一键复制 编辑 原始数据 按行查看 历史
Administrator 提交于 2014-02-26 21:28 . 封装serversocket
/*
* File: ServerSocket.h
* Author: Vicky.H
* Email: eclipser@163.com
*
* Created on 2014年2月26日, 下午8:43
*/
#ifndef CN_VICKY__SERVERSOCKET_H
#define CN_VICKY__SERVERSOCKET_H
#include "Socket.h"
class ServerSocket {
public:
// constructor
ServerSocket(unsigned int port, unsigned int backlog = 5);
// destructor
~ServerSocket();
public:
// close socket
void close();
// accept new connection
bool accept(Socket* socket);
// get/set socket's linger status
unsigned int getLinger() {
return m_Socket->getLinger();
}
void setLinger(unsigned int lingertime) {
m_Socket->setLinger(lingertime);
}
// get/set socket's nonblocking status
bool isNonBlocking() const {
return m_Socket->isNonBlocking();
}
void setNonBlocking(bool on = true) {
m_Socket->setNonBlocking(on);
}
// get/set receive buffer size
unsigned int getReceiveBufferSize() const {
return m_Socket->getReceiveBufferSize();
}
void setReceiveBufferSize(unsigned int size) {
m_Socket->setReceiveBufferSize(size);
}
// get/set send buffer size
unsigned int getSendBufferSize() const {
return m_Socket->getSendBufferSize();
}
void setSendBufferSize(unsigned int size) {
m_Socket->setSendBufferSize(size);
}
SOCKET getSOCKET() {
return m_Socket->getSOCKET();
}
protected:
// socket implementation object
Socket* m_Socket;
};
#endif /* CN_VICKY__SERVERSOCKET_H */
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/ysguoqiang/socket.git
git@gitee.com:ysguoqiang/socket.git
ysguoqiang
socket
socket
master

搜索帮助