c++ - Read console input via select function -


I am trying to write a program that uses socket to send data to the network. Now I get input command from the console I have a selection function for sockets. In linux you can use selection to view data inputs in sockets and conols. How can I get the same functionality on Visual C ++?

When I put the console descriptor in the selected function, then error 10038 (socket operation on non-set).

Windows does not support using the select for arbitrary handles In other forms of Linux and Unix, "All handles are identical", and it is not important whether they have been handled for a console, socket or something.

Note that select does not handle any in the windows, but a special socket is the type of handle. See Definition of Windows

The easiest solution to read the console input is to use another thread. There is no way to include the console in your select call. There may be ways to explain Windows that a socket is a wait-free object, and it has a console input handle Use some kind of simultaneously - but I'm not sure (and I do not have a Windows setup to try it out)

Comments

Popular posts from this blog

jasper reports - How to center align barcode using jasperreports and barcode4j -

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -