mirror of
https://github.com/godotengine/godot
synced 2024-10-14 12:30:21 +00:00
Add TCP poll function (not exposed).
Used to know if we can read or write without blocking.
This commit is contained in:
parent
8cb6d5daa4
commit
74051c77dc
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue