Reading input on c++ server in real time [closed] - c++

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I want to write a server in C++, I would connect to this server via Netcat or Telnet. Server would send a menu to a client and client would navigate using the arrows to choose an option. My question is: how can I get char-messages in real time (not after clicking Enter) from client?

C++ standard library has no API for keyboard input. There is only API for streams, which do require pressing enter (or EOT).
Implementing direct keyboard input on POSIX shell is quite tricky, and I would instead recommend using an existing library.
In particular, an implementation of the curses library will have a getch function that you can poll in a loop.

Related

Control the external program to generate output with Qt program in C++ [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
I have seen a few sample of running .exe file in a Qt program but is it possible to invoke the functions in the external program?
For example, external program A is an existing application which receives input and generates output. Program A requires the users' interaction with the GUI of Program A in order to work. How do I pass the input to program A and get output for my current Qt program without showing and using the GUI of Program A.
actually you can and this is knonw in the it world as IPC
every Operating Sytem has some interfaces to allow you to do that and qt has some concrete implementations of these. (https://doc.qt.io/qt-5/ipc.html)
Inter-Process Communication in Qt
TCP/IP
Local Server/Socket
Shared Memory
D-Bus protocol
QProcess Class
Session Management
but this is not going to work out of the box, you need to "enable" such capabilities in your qt app and the 3rd app triggering the methods must be:
able to call IPC interfaces,
able to know what interfaces are exposed by your qt app (what is the signature of the method etc etc)

How to capture audio from specific application and route to specific audio device in Windows 7? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
The community reviewed whether to reopen this question 6 months ago and left it closed:
Original close reason(s) were not resolved
Improve this question
Ok, my question is this:
How can I programmatically capture audio from a specific application and then send it to a specific audio device in Windows 7?
I know for a fact this can be done, since SoundLeech captures audio from individual programs, and theoretically once you have the sound you can do what you want with it (including play it to any sound output device).
I'm a C++ programmer but I know very little about Windows programming. I need some pointers to capturing sound from individual programs. I work with audio recording very frequently and I would be willing to put in a large amount of work to develop a way to better handle sound in Windows given how difficult to use it currently is.
So how can I capture audio streams directly from applications without first routing them through Virtual Audio Cables or the like?
You cannot do it using standard user mode APIs. You need to either hook APIs or create virtual devices to accept application streams/sessions.
Intercepting and postprocessing all audio streams on Windows
Recording Audio Output from a Specific Program on Windows
Is it possible to caputre the rendering audio session from another process?
Capture audio of a single application on Windows 7

int value of COM11? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I have a RFID Reader that connect to my computer via COM.
1> When the reader connect to my computer via COM3
C++: OpenComm(3) --> OK
2> When the reader connect to my computer via COM9
C++: OpenComm(9) --> OK
3> When the reader connect to my computer via COM11
C++: OpenComm(11) --> Not work
I don't know why it not work.
OpenComm(int com) is a attached library for my RFID Reader. So, I need int value of COM11.
Assuming that you're using Windows - from the CreateFile documentation:
To specify a COM port number greater than 9, use the following syntax:
"\.\COM10". This syntax works for all port numbers and hardware that
allows COM port numbers to be specified

How to check if a server port is open and connect from MFC [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I need my CASyncSocket to check on a certain port on a host and connect to it as soon as it is available.
I am a java guy and is new to C++, I know that I can do error handling and try connecting again and again. But I am unsure how to implement this in MFC.
Any help will be highly appreciated.
As far as I know the only way to check if a server port is open is to try and connect. Use the CAsyncSocket Connect function. You get a callback (OnConnect) letting you know whether the connection attempt worked or not. If it did not work use a timer (SetTimer/WM_TIMER) to try again.
There are several CAsyncSocket example apps in MSDN.

Interactions with other application [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
I'm a learning c++, I want to know that how programs are made that can interact with other application in windows.By interaction I mean like clicking a button, giving keyboard input, changing settings of that application, changing options or even editing or creating files.How can I make such Programs in C++?
How you interact with other applications depends on your OS. If e.g your application runs on windows you have to use the Win32 API. The Win32 API are functions provided by the OS allowing you to interact not just with other applications but also with the OS itself, e.g to set up windows or to open files.
Win32 provides a messaging system. Every application has a message loop and accepts messages from the OS (e.g about mouse clicks) but can also receive messsages from other applications. The receiver cant decide whether the message comes from the OS or from another process.
To e.g change the title, you have to send the other application a WM_SETTEXT message using the SendMessage function.
Directly interacting with another application (changing its values, not just modifying the GUI) is just possible, if the application provides some kind of interface. These could be a network connection, named pipes, shared memory or some module/plugin loading mechanism (through dlls). Otherwise its not possible (easily).
For UNIX based OS an API called POSIX exists providing similiar functionality as Win32.