diff options
author | Gurusamy Sarathy <gsar@cpan.org> | 1997-12-24 04:21:30 +0000 |
---|---|---|
committer | Gurusamy Sarathy <gsar@cpan.org> | 1997-12-24 04:21:30 +0000 |
commit | f998180f71571d04f7a71972eb8eb78805338f5c (patch) | |
tree | b8dfd588a195e6aacb01d3878a7f08d2d94b4153 /win32/win32sck.c | |
parent | e34ffe5a86599b66240875a414d90fdf19ed7649 (diff) | |
download | perl-f998180f71571d04f7a71972eb8eb78805338f5c.tar.gz |
[win32] support ioctl() on sockets (does what ioctlsocket() does) to make
non-blocking IO on sockets possible
p4raw-id: //depot/win32/perl@387
Diffstat (limited to 'win32/win32sck.c')
-rw-r--r-- | win32/win32sck.c | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/win32/win32sck.c b/win32/win32sck.c index 64d1a0a65c..a6e7a990b8 100644 --- a/win32/win32sck.c +++ b/win32/win32sck.c @@ -223,7 +223,7 @@ win32_getsockopt(SOCKET s, int level, int optname, char *optval, int *optlen) return r; } -int +DllExport int win32_ioctlsocket(SOCKET s, long cmd, u_long *argp) { int r; @@ -466,6 +466,28 @@ win32_getservbyport(int port, const char *proto) return r; } +int +win32_ioctl(int i, unsigned int u, char *data) +{ + u_long argp = (u_long)data; + int retval; + + if (!wsock_started) { + croak("ioctl implemented only on sockets"); + /* NOTREACHED */ + } + + retval = ioctlsocket(TO_SOCKET(i), (long)u, &argp); + if (retval == SOCKET_ERROR) { + if (WSAGetLastError() == WSAENOTSOCK) { + croak("ioctl implemented only on sockets"); + /* NOTREACHED */ + } + errno = WSAGetLastError(); + } + return retval; +} + char FAR * win32_inet_ntoa(struct in_addr in) { |