diff options
-rw-r--r-- | core/io/stream_peer_tcp.cpp | 5 | ||||
-rw-r--r-- | core/io/stream_peer_tcp.h | 3 |
2 files changed, 8 insertions, 0 deletions
diff --git a/core/io/stream_peer_tcp.cpp b/core/io/stream_peer_tcp.cpp index 044431743a..f0c5816d73 100644 --- a/core/io/stream_peer_tcp.cpp +++ b/core/io/stream_peer_tcp.cpp @@ -288,6 +288,11 @@ void StreamPeerTCP::disconnect_from_host() { peer_port = 0; } +Error StreamPeerTCP::poll(NetSocket::PollType p_type, int timeout) { + ERR_FAIL_COND_V(_sock.is_null() || !_sock->is_open(), ERR_UNAVAILABLE); + return _sock->poll(p_type, timeout); +} + Error StreamPeerTCP::put_data(const uint8_t *p_data, int p_bytes) { int total; diff --git a/core/io/stream_peer_tcp.h b/core/io/stream_peer_tcp.h index f16d4a2bd4..327aa3cc3b 100644 --- a/core/io/stream_peer_tcp.h +++ b/core/io/stream_peer_tcp.h @@ -78,6 +78,9 @@ public: void set_no_delay(bool p_enabled); + // Poll functions (wait or check for writable, readable) + Error poll(NetSocket::PollType p_type, int timeout = 0); + // Read/Write from StreamPeer Error put_data(const uint8_t *p_data, int p_bytes); Error put_partial_data(const uint8_t *p_data, int p_bytes, int &r_sent); |