mirror of
https://github.com/godotengine/godot.git
synced 2025-10-19 16:03:29 +00:00
Add TCP Server is_listening method
This commit is contained in:
parent
24c52f1c2e
commit
c13be79594
3 changed files with 15 additions and 0 deletions
|
@ -34,6 +34,7 @@ void TCP_Server::_bind_methods() {
|
|||
|
||||
ClassDB::bind_method(D_METHOD("listen", "port", "bind_address"), &TCP_Server::listen, DEFVAL("*"));
|
||||
ClassDB::bind_method(D_METHOD("is_connection_available"), &TCP_Server::is_connection_available);
|
||||
ClassDB::bind_method(D_METHOD("is_listening"), &TCP_Server::is_listening);
|
||||
ClassDB::bind_method(D_METHOD("take_connection"), &TCP_Server::take_connection);
|
||||
ClassDB::bind_method(D_METHOD("stop"), &TCP_Server::stop);
|
||||
}
|
||||
|
@ -75,6 +76,12 @@ Error TCP_Server::listen(uint16_t p_port, const IP_Address &p_bind_address) {
|
|||
return OK;
|
||||
}
|
||||
|
||||
bool TCP_Server::is_listening() const {
|
||||
ERR_FAIL_COND_V(!_sock.is_valid(), false);
|
||||
|
||||
return _sock->is_open();
|
||||
}
|
||||
|
||||
bool TCP_Server::is_connection_available() const {
|
||||
|
||||
ERR_FAIL_COND_V(!_sock.is_valid(), false);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue