I'm porting some code from BSD sockets to Winsock, and I'm not sure how to handle the case below.
My original application runs a select on both stdin and the network socket:
FD_SET(sock, &fd);
FD_SET(0, &fd);
...
if (select(..., &fd, ... )...)
Trying to run this in Winsock gives an error 10038 (WSAENOTSOCK), which makes sense, since what was file handle 0 in Linux (stdin) is not a socket (more precisely: a SOCKET type) in Windows.
Is there an easy way to port this test to Windows sockets?
I'd love to be corrected, but as far as I know, Winsock does not extend beyond the realm of sockets. That is, Unix's "everything is a file" philosophy for the select(), read(), write(), etc system calls is not there in Winsock.
I'm sure you can do something similar with just the Win32 API working on socket and console handles, but it's not going to look much like Winsock (or BSD) anymore.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With