blob: 9ed1abb06553f29761dcdf8f0a33e2ad8115bc63 [file] [log] [blame]
William A. Kennington III7d6fa422021-02-08 17:04:02 -08001#pragma once
2
3#include <sys/types.h>
4
5namespace net
6{
7
8class SockIO
9{
10 public:
11 SockIO() = default;
12 explicit SockIO(int sockfd) : sockfd_{sockfd}
13 {}
14 virtual ~SockIO();
15
16 int get_sockfd() const
17 {
18 return sockfd_;
19 }
20
21 virtual int write(const void* buf, size_t len);
22
23 virtual int close();
24
25 virtual int recv(void* buf, size_t maxlen);
26
27 protected:
28 int sockfd_ = -1;
29};
30
31} // namespace net