diff options
author | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2006-06-08 05:20:00 +0000 |
---|---|---|
committer | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2006-06-08 05:20:00 +0000 |
commit | 98f09b9618e274106f336149a2ee81c939b2d870 (patch) | |
tree | e1014a96266a2a83c74d635fc9e3f6c4273287b3 /win32/win32.c | |
parent | 75da7a9863382a994a2e4afc33f261902d830c39 (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/branches/ruby_1_8@10233 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 321c30384d..415dd42b7c 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -3556,6 +3556,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) { |