Windows Vista Beta | WinVistaBeta.com - Message | Mixing input on sockets and stdin in Win32 Console Application

November 23, 2008  
Subject: Mixing input on sockets and stdin in Win32 Console Application
Group: microsoft.public.msdn.general
Date: 6/19/2008 5:36:01 PM
From: =?Utf-8?B?RGF2aWQ=?= [Email Address Protection]

I am writing a Win32 console application. The application is a socket client
using winsock2 (WS2_32.lib). Most input comes from stdin, but I would like
the application to receive unsolicited data on the socket. Is there a way to
do this?

One web source http://beej.us/guide/bgnet/examples/select.c suggests that
you can add stdin as one of the file descriptors passed to the select()
statement. While that may work with BSD sockets, it fails with winsock2,
generating the error WSAENOTSOCK (10038) Socket operation on non-socket.

Any suggestions

Back