TcpServer.hpp
Go to the documentation of this file.
1 
6 #pragma once
7 #include <enet/Tcp.hpp>
8 #ifdef __TARGET_OS__Windows
9 
10 #else
11  #include <poll.h>
12 #endif
13 
14 namespace enet {
15  class TcpServer {
16  private:
17  #ifdef __TARGET_OS__Windows
18  SOCKET m_socketId;
19  #else
20  int32_t m_socketId;
21  #endif
22  #ifndef __TARGET_OS__Windows
23  struct pollfd m_fds[1];
24  #endif
25  public:
26  TcpServer();
27  virtual ~TcpServer();
28  private:
29  std::string m_host;
30  public:
38  void setIpV4(uint8_t _fist, uint8_t _second, uint8_t _third, uint8_t _quatro);
43  void setHostNane(const std::string& _name);
48  const std::string& getHostName() {
49  return m_host;
50  }
51  private:
52  uint16_t m_port;
53  public:
58  void setPort(uint16_t _port);
63  uint16_t getPort() {
64  return m_port;
65  }
66  public:
67  bool link();
68  bool unlink();
74  };
75 }
76 
uint16_t getPort()
Get the port number.
Definition: TcpServer.hpp:63
Definition: TcpServer.hpp:15
void setPort(uint16_t _port)
set the port number to connect or to spy
void setHostNane(const std::string &_name)
set the Host name is the same things as set an Ip adress, but in test mode "127.0.0.1" or "localhost".
enet::Tcp waitNext()
Wait next extern connection.
void setIpV4(uint8_t _fist, uint8_t _second, uint8_t _third, uint8_t _quatro)
Set the connection IP id.
const std::string & getHostName()
Get the decriptive name hot the host.
Definition: TcpServer.hpp:48
Definition: Tcp.hpp:16
Main esvg namespace.
Definition: enet.hpp:17