C++ terminal server for existing terminal client protocol - c++

I want to communicate with a C++ simulated UART which is communicating with a (simulated) guest Linux system terminal.
What I have is a callback called when receiving character outputs from the UART, and a method I can call to send characters to this same UART.
I'd like to be able to connect to this UART with my host terminal, implementing a server socket communicating using an existing protocol.
What protocol should I use to keep a high compatibility? I'm thinking about telnet. Are there existing frameworks in C++ or C to implement that quick and easy?

Related

send data lwip STM32 PC

I am trying to send or receive data from STM32f(via raw lwip) to computer.
I connected stm32f device to modem and send "ping" and it is ok.dhcp in lwip have got the ip number from modem.And I would like to use QT Creature to send data to STM32 via lwip(connected modem).I dont know what my port number is.What will I write in this codes as port number.
Could you offer me a way,what will I do.
Also, is it possible if I connect the stm32f device directly to computer and communication?
tcpSocket->connectToHost(QHostAddress("192.168.1.30"),portnumber);
What is the value you put in the tcp_bind function call? This should be the port you are listening on. It would be best if you would use a port over 1024 because of the privileged access needed on normal systems with operating systems.

IPC between FastCGI C++ / Nginx and C++ Application

I'm trying to create a Gateway which offers a RESTful interface to send/receive messages to Devices which communicate over Bluetooth Low Energy (BLE). Basically it translates GATT to HTTP and vice versa.
The basic architecture looks as follows:
A BLE Dongle is connected to a Linux computer (f.e. Raspberry Pi) a C-Program opens a serial connection to the BLE Dongle to send/receive/process messages. It receives requests from a C++ Application over IPC using a TCP/IP Socket and also uses this socket to forward replies from BLE Devices (f.e. Sensors) to the C++ Application (which acts as a multithreaded server for each connected BLE Dongle).
The C++ Application saves this information (f.e. discovered devices, connected devices and their data) and also implements an interface to control basic Bluetooth Low Energy functions like Discovery,Connect.. etc.
A client can send HTTP Requests (GET/POST) to a Nginx Webserver which uses FastCGI. I would like to parse the requests in this FastCGI Application and then communicate with the C++ Application to execute the commands
f.e. Client opens an URI xyz/discover sending a GET Request. The FastCGI Application parses this requests and calls the Discover function of the C++ Application to start a Bluetooth Low Energy discovery.
My Question is how to best communicate between the C++ Application and the FastCGI C++ Application.
My Ideas:
The C++ App forks a new child which does exec fcgi-spawn (path to my fcgi app as an argument). Then create two pipes for full-duplex communication between parent and child
Using named Pipes between both processes
Is it a good idea to just integrate the FastCGI functionality in my C++ Application? The C++ App runs several Threads: one to accept new TCP connections in case a new Dongle is connected. It starts a Thread for each new Dongle. Could I just create another thread which is responsible for parsing FastCGI Requests?
Since I never really worked with FastCGI and nginx I'm just learning as I go. So I would be grateful for some input. Thanks!

How to intercept data between a port and an application in Windows?

Is there a way to take data from a port, then feed it back to the program using that port in Windows (C,C++,C#)?
Can sockets or pipes be used to detour the data from the port to my program then back to the application?

Sending NS-3 packets through user-defined socket to another terminal

I wanted to know if anyone has any idea of how I can handle this scenario:
I want to have two terminals open. In one of them I want to run an NS-3 script file which generates packets and sends it through a socket to the other terminal.
The other terminal (which is only running a simple C socket program) receives the packet through the socket (and ideally displays the payload or even simpler increases a packet counter).
Any ideas appreciated...
Yes, you can make ns-3 interact with the real world.
Please read this tutorial :
http://www.nsnam.org/wiki/HOWTO_make_ns-3_interact_with_the_real_world
Especially Tap bridge. The Tap Bridge is designed to integrate “real” internet hosts (or more precisely, hosts that support Tun/Tap devices) into ns-3 simulations
http://www.nsnam.org/docs/release/3.18/models/html/tap.html

Virtual COM port to Socket communication

I have a virtual COM port and socket in my app , i want to transfer data from this Virtual COM port to a socket and vice versa.
How can i do this?
Is there some sample code or good library out there to do so? Eventually this should work on Windows CE, but initially it should work on regular Windows.
It depends what you need the service to do.
Is it bi-directional, does opening the port have to automatically setup a new network link, do you need to set serial port parameters over the network?
If you only really need to remote a serial port and don't need any command and control data then most introductions to network programming start with some sort of chat server where everything typed at the client end goes to the server as text - it should be trivial to modify this so that the source text comes from a serial port