diff options
| author | Fabio Alessandrelli | 2017-01-18 08:37:24 +0100 |
|---|---|---|
| committer | Fabio Alessandrelli | 2017-01-23 20:15:20 +0100 |
| commit | b2839343cab66880f647c77da7b2e1826761776a (patch) | |
| tree | 44a10cc71b474354f3b4d20b3244d5306a9e65dd /core/io | |
| parent | 4198291cd45da7fce278d21cd5ef4a506086d5f8 (diff) | |
| download | godot-b2839343cab66880f647c77da7b2e1826761776a.tar.gz godot-b2839343cab66880f647c77da7b2e1826761776a.tar.zst godot-b2839343cab66880f647c77da7b2e1826761776a.zip | |
Implement TCP Server bind address
Diffstat (limited to 'core/io')
| -rw-r--r-- | core/io/tcp_server.cpp | 12 | ||||
| -rw-r--r-- | core/io/tcp_server.h | 3 |
2 files changed, 2 insertions, 13 deletions
diff --git a/core/io/tcp_server.cpp b/core/io/tcp_server.cpp index bfa5dce58..b8a783152 100644 --- a/core/io/tcp_server.cpp +++ b/core/io/tcp_server.cpp @@ -44,16 +44,6 @@ TCP_Server* TCP_Server::create() { return _create(); } -Error TCP_Server::_listen(uint16_t p_port, PoolVector<String> p_accepted_hosts) { - - List<String> hosts; - for(int i=0;i<p_accepted_hosts.size();i++) - hosts.push_back(p_accepted_hosts.get(i)); - - return listen(p_port, hosts.size()?&hosts:NULL); - -} - void TCP_Server::set_ip_type(IP::Type p_type) { stop(); ip_type = p_type; @@ -62,7 +52,7 @@ void TCP_Server::set_ip_type(IP::Type p_type) { void TCP_Server::_bind_methods() { ClassDB::bind_method(_MD("set_ip_type","ip_type"),&TCP_Server::set_ip_type); - ClassDB::bind_method(_MD("listen","port","accepted_hosts"),&TCP_Server::_listen,DEFVAL(PoolVector<String>())); + ClassDB::bind_method(_MD("listen","port","bind_address"),&TCP_Server::listen,DEFVAL("*")); ClassDB::bind_method(_MD("is_connection_available"),&TCP_Server::is_connection_available); ClassDB::bind_method(_MD("take_connection"),&TCP_Server::take_connection); ClassDB::bind_method(_MD("stop"),&TCP_Server::stop); diff --git a/core/io/tcp_server.h b/core/io/tcp_server.h index 3d7b3ddd8..cf9a1e4a9 100644 --- a/core/io/tcp_server.h +++ b/core/io/tcp_server.h @@ -43,12 +43,11 @@ protected: static TCP_Server* (*_create)(); //bind helper - Error _listen(uint16_t p_port, PoolVector<String> p_accepted_hosts=PoolVector<String>()); static void _bind_methods(); public: virtual void set_ip_type(IP::Type p_type); - virtual Error listen(uint16_t p_port, const List<String> *p_accepted_hosts=NULL)=0; + 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; |
