diff options
| -rw-r--r-- | src/w32.c | 16 |
1 files changed, 16 insertions, 0 deletions
| @@ -3709,8 +3709,24 @@ sys_write (int fd, const void * buffer, unsigned int count) | |||
| 3709 | #ifdef HAVE_SOCKETS | 3709 | #ifdef HAVE_SOCKETS |
| 3710 | if (fd_info[fd].flags & FILE_SOCKET) | 3710 | if (fd_info[fd].flags & FILE_SOCKET) |
| 3711 | { | 3711 | { |
| 3712 | unsigned long nblock = 0; | ||
| 3712 | if (winsock_lib == NULL) abort (); | 3713 | if (winsock_lib == NULL) abort (); |
| 3714 | |||
| 3715 | /* TODO: implement select() properly so non-blocking I/O works. */ | ||
| 3716 | /* For now, make sure the write blocks. */ | ||
| 3717 | if (fd_info[fd].flags & FILE_NDELAY) | ||
| 3718 | pfn_ioctlsocket (SOCK_HANDLE (fd), FIONBIO, &nblock); | ||
| 3719 | |||
| 3713 | nchars = pfn_send (SOCK_HANDLE (fd), buffer, count, 0); | 3720 | nchars = pfn_send (SOCK_HANDLE (fd), buffer, count, 0); |
| 3721 | |||
| 3722 | /* Set the socket back to non-blocking if it was before, | ||
| 3723 | for other operations that support it. */ | ||
| 3724 | if (fd_info[fd].flags & FILE_NDELAY) | ||
| 3725 | { | ||
| 3726 | nblock = 1; | ||
| 3727 | pfn_ioctlsocket (SOCK_HANDLE (fd), FIONBIO, &nblock); | ||
| 3728 | } | ||
| 3729 | |||
| 3714 | if (nchars == SOCKET_ERROR) | 3730 | if (nchars == SOCKET_ERROR) |
| 3715 | { | 3731 | { |
| 3716 | DebPrint(("sys_read.send failed with error %d on socket %ld\n", | 3732 | DebPrint(("sys_read.send failed with error %d on socket %ld\n", |