Recast  1
Game with custom magic
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
Socket.hpp
Go to the documentation of this file.
1 
11 #ifndef RECAST_SERVER_SOCKET_HPP
12 #define RECAST_SERVER_SOCKET_HPP
13 
14 #include "NetworkUtils.hpp"
15 
16 class Socket {
17 public:
19  Socket(int sd) : socketDescr(sd), socketBoundPort(0) {}
21 public:
22  int getSocketDescr() const noexcept { return socketDescr; }
23  void setNonBlocked(bool option);
24  void close() { ::close(socketDescr); }
25  virtual void createServerSocket() = 0;
26 protected:
27  void setReuseAddress(int sd);
29  uint32_t socketBoundPort;
30 };
31 
32 #endif //RECAST_SERVER_SOCKET_HPP
virtual void createServerSocket()=0
Socket()
Definition: Socket.hpp:18
~Socket()
Definition: Socket.hpp:20
void close()
Definition: Socket.hpp:24
void setNonBlocked(bool option)
Definition: Socket.cpp:23
int getSocketDescr() const noexcept
Definition: Socket.hpp:22
void setReuseAddress(int sd)
Definition: Socket.cpp:27
uint32_t socketBoundPort
Definition: Socket.hpp:29
Definition: Socket.hpp:16
Basic networking utils header file.
Socket(int sd)
Definition: Socket.hpp:19
int socketDescr
Definition: Socket.hpp:28