diff options
author | santiagopf <punto@Ariels-Mac-mini.local> | 2015-12-14 10:58:26 -0300 |
---|---|---|
committer | santiagopf <punto@Ariels-Mac-mini.local> | 2015-12-14 10:58:26 -0300 |
commit | a9795d582665598decd4e73e1d879c83ce28a44b (patch) | |
tree | 777a3da33fed3d6906704680e01bd87f97eba113 /drivers/unix/stream_peer_tcp_posix.cpp | |
parent | c8077de71475c174aa14fd045a2cddfc28de2468 (diff) | |
parent | bfaa179e7088d9d6f4cf289e1915eec12c6b3b2a (diff) |
Merge branch 'master' of https://github.com/godotengine/godot
Diffstat (limited to 'drivers/unix/stream_peer_tcp_posix.cpp')
-rw-r--r-- | drivers/unix/stream_peer_tcp_posix.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/unix/stream_peer_tcp_posix.cpp b/drivers/unix/stream_peer_tcp_posix.cpp index 5aa3915893..edf5e02971 100644 --- a/drivers/unix/stream_peer_tcp_posix.cpp +++ b/drivers/unix/stream_peer_tcp_posix.cpp @@ -38,6 +38,7 @@ #include <string.h> #include <netdb.h> #include <sys/types.h> +#include <sys/ioctl.h> #ifndef NO_FCNTL #ifdef __HAIKU__ #include <fcntl.h> @@ -367,6 +368,14 @@ Error StreamPeerTCPPosix::get_partial_data(uint8_t* p_buffer, int p_bytes,int &r return read(p_buffer, p_bytes, r_received, false); }; +int StreamPeerTCPPosix::get_available_bytes() const { + + unsigned long len; + int ret = ioctl(sockfd,FIONREAD,&len); + ERR_FAIL_COND_V(ret==-1,0) + return len; + +} IP_Address StreamPeerTCPPosix::get_connected_host() const { return peer_host; |