From 98f09b9618e274106f336149a2ee81c939b2d870 Mon Sep 17 00:00:00 2001 From: usa Date: Thu, 8 Jun 2006 05:20:00 +0000 Subject: * 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 --- win32/win32.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'win32/win32.c') 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) { -- cgit v1.2.3