diff options
Diffstat (limited to 'core/io/tcp_server.h')
-rw-r--r-- | core/io/tcp_server.h | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/core/io/tcp_server.h b/core/io/tcp_server.h index 7353390bef..4c89197d9a 100644 --- a/core/io/tcp_server.h +++ b/core/io/tcp_server.h @@ -32,6 +32,7 @@ #define TCP_SERVER_H #include "core/io/ip.h" +#include "core/io/net_socket.h" #include "core/io/stream_peer.h" #include "core/io/stream_peer_tcp.h" @@ -40,22 +41,22 @@ class TCP_Server : public Reference { GDCLASS(TCP_Server, Reference); protected: - static TCP_Server *(*_create)(); + enum { + MAX_PENDING_CONNECTIONS = 8 + }; - //bind helper + Ref<NetSocket> _sock; static void _bind_methods(); public: - virtual Error listen(uint16_t p_port, const IP_Address &p_bind_address = IP_Address("*")) = 0; - virtual bool is_connection_available() const = 0; - virtual Ref<StreamPeerTCP> take_connection() = 0; + Error listen(uint16_t p_port, const IP_Address &p_bind_address = IP_Address("*")); + bool is_connection_available() const; + Ref<StreamPeerTCP> take_connection(); - virtual void stop() = 0; //stop listening - - static Ref<TCP_Server> create_ref(); - static TCP_Server *create(); + void stop(); // Stop listening TCP_Server(); + ~TCP_Server(); }; #endif // TCP_SERVER_H |