diff options
author | jsorg71 <jsorg71> | 2006-12-09 20:28:41 +0000 |
---|---|---|
committer | jsorg71 <jsorg71> | 2006-12-09 20:28:41 +0000 |
commit | ea3f8ba0b7f085d23aa6f05f0ca418da6524490b (patch) | |
tree | 4c7a5b0bf0cfc24a0d5907f1075fe565d41849de | |
parent | b295e08ad2f450f5bda8682d82a865b0db531382 (diff) | |
download | xrdp-proprietary-ea3f8ba0b7f085d23aa6f05f0ca418da6524490b.tar.gz xrdp-proprietary-ea3f8ba0b7f085d23aa6f05f0ca418da6524490b.zip |
added g_tcp_can_send
-rw-r--r-- | common/os_calls.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/common/os_calls.c b/common/os_calls.c index ebdf5491..c48fe99e 100644 --- a/common/os_calls.c +++ b/common/os_calls.c @@ -435,6 +435,31 @@ g_tcp_send(int sck, const void* ptr, int len, int flags) } /*****************************************************************************/ +/* wait 'millis' milliseconds for the socket to be able to write */ +/* returns boolean */ +int +g_tcp_can_send(int sck, int millis) +{ + fd_set wfds; + struct timeval time; + int rv; + + time.tv_sec = millis / 1000; + time.tv_usec = (millis * 1000) % 1000000; + FD_ZERO(&wfds); + if (sck > 0) + { + FD_SET(((unsigned int)sck), &wfds); + rv = select(sck + 1, 0, &wfds, 0, &time); + if (rv > 0) + { + return 1; + } + } + return 0; +} + +/*****************************************************************************/ int g_tcp_select(int sck1, int sck2) { |