Add TCP poll function (not exposed).
Used to know if we can read or write without blocking.
This commit is contained in:
@ -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);
|
||||
|
||||
Reference in New Issue
Block a user