VOX
A little voxel engine
Loading...
Searching...
No Matches
Socket.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <unistd.h>
4#include <sys/socket.h>
5#include <sys/types.h>
6#include <exception>
7#include <stdexcept>
8
9#include "Poller.hpp"
10
11class Poller;
12
16class Socket
17{
18public:
19 virtual ~Socket();
20 int getFd() const;
21
22 Socket(const Socket& other) = delete;
23 Socket& operator=(const Socket& other) = delete;
24
25 Socket(Socket&& other);
26 Socket& operator=(Socket&& other);
27
28 bool operator==(const Socket& other) const;
29 bool operator==(const int & fd) const;
30protected:
31 Socket();
32 int m_sockfd = -1;
33 void close();
34private:
35 friend class Poller;
36};
Definition: Poller.hpp:13
a RAII wrapper for a socket.
Definition: Socket.hpp:17
int getFd() const
Definition: Socket.cpp:46
int m_sockfd
Definition: Socket.hpp:32
void close()
Definition: Socket.cpp:37
Socket()
Definition: Socket.cpp:3
Socket & operator=(const Socket &other)=delete
Socket(const Socket &other)=delete
bool operator==(const Socket &other) const
Definition: Socket.cpp:27
virtual ~Socket()
Definition: Socket.cpp:7