summaryrefslogtreecommitdiff
path: root/platform/windows
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2015-12-13 12:53:29 -0300
committerJuan Linietsky <reduzio@gmail.com>2015-12-13 12:53:29 -0300
commit95a469ad28e54fe05c3ae548725e557f91021d79 (patch)
tree52b9ee5ebd82671f69e4bab9417ebaf751914048 /platform/windows
parent451b1d91446f6e15763b4d6ec3bd6d74c2be8080 (diff)
added binary API to StreamPeer, fixes #2863
Diffstat (limited to 'platform/windows')
-rw-r--r--platform/windows/stream_peer_winsock.cpp8
-rw-r--r--platform/windows/stream_peer_winsock.h2
2 files changed, 10 insertions, 0 deletions
diff --git a/platform/windows/stream_peer_winsock.cpp b/platform/windows/stream_peer_winsock.cpp
index e8245c92e5..5bc3e34107 100644
--- a/platform/windows/stream_peer_winsock.cpp
+++ b/platform/windows/stream_peer_winsock.cpp
@@ -342,6 +342,14 @@ void StreamPeerWinsock::set_nodelay(bool p_enabled) {
setsockopt(sockfd, IPPROTO_TCP, TCP_NODELAY, (char*)&flag, sizeof(int));
}
+int StreamPeerWinsock::get_available_bytes() const {
+
+ unsigned long len;
+ int ret = ioctlsocket(sockfd,FIONREAD,&len);
+ ERR_FAIL_COND_V(ret==-1,0)
+ return len;
+
+}
IP_Address StreamPeerWinsock::get_connected_host() const {
diff --git a/platform/windows/stream_peer_winsock.h b/platform/windows/stream_peer_winsock.h
index 373b502d2c..5dd836aa0c 100644
--- a/platform/windows/stream_peer_winsock.h
+++ b/platform/windows/stream_peer_winsock.h
@@ -66,6 +66,8 @@ public:
virtual Error get_data(uint8_t* p_buffer, int p_bytes);
virtual Error get_partial_data(uint8_t* p_buffer, int p_bytes,int &r_received);
+ virtual int get_available_bytes() const;
+
void set_socket(int p_sockfd, IP_Address p_host, int p_port);
virtual IP_Address get_connected_host() const;