diff options
author | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2006-06-08 05:01:51 +0000 |
---|---|---|
committer | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2006-06-08 05:01:51 +0000 |
commit | da617f7f79e11bfa92adaaa48be1d2cb0f16096a (patch) | |
tree | 3dd8d8c58a81d3539d89f9cf02cc3e412d668040 /win32/win32.c | |
parent | a0261afccd73ab4907958ee0f7de27ca5a62d6aa (diff) |
* win32/win32.[ch] (rb_w32_read, rb_w32_write): new functions.
use recv() and send() when fd is socket. fixed: [ruby-dev:28694]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10231 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'win32/win32.c')
-rw-r--r-- | win32/win32.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/win32/win32.c b/win32/win32.c index 2a117ab4f0..b780da07f1 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -3861,6 +3861,30 @@ rb_w32_close(int fd) return 0; } +#undef read +size_t +rb_w32_read(int fd, void *buf, size_t size) +{ + SOCKET sock = TO_SOCKET(fd); + + if (!is_socket(sock)) + return read(fd, buf, size); + else + return rb_w32_recv(fd, buf, size, 0); +} + +#undef write +size_t +rb_w32_write(int fd, const void *buf, size_t size) +{ + SOCKET sock = TO_SOCKET(fd); + + if (!is_socket(sock)) + return write(fd, buf, size); + else + return rb_w32_send(fd, buf, size, 0); +} + static int unixtime_to_filetime(time_t time, FILETIME *ft) { |