Socket communication between c++ Client and node.js Server - c++

I want to make my c++ app (running on Linux system) to connect and send data to node.server via socket.
I tried to implement small sample app by using socket.io library (https://github.com/uning/socket.io-client-cpp), but doesnt helping me to achieve my goal.
Any guidance on this or alternative to do something like this.

Related

Multiple Simultaneous gRPC connections to different servers via different interfaces (eth0, wlan0, ppp0)

We have started using gRPC C++ for our embedded system project (ARM Processor Cortex-A7) as a client. We have successfully created a sample application which communicates with the server using protobuf.
We have a new requirement now. We have to open multiple connections to the different endpoints (or server) via different interfaces (like ethernet, wifi and cellular [using ppp]).
I tried to google but couldn't find any solutions to it. I have tried gRPC forum but hasn't received a proper reply to my question.
I have wondering if gRPC has provision to bind to a particular interface or IP. Linux POSIX socket provides SO_BINDTODEVICE option but I am not sure if gRPC has any application layer method or function to achieve it (can't find it in the documentation).
Or Can we achieve it via some other hack (may be by modifying the routing table?).

Can I use ZeroMQ with UNIX sockets in the same thread in C++?

I am trying to use ZeroMQ to connect to a historical data server written in Python while I connect to Interactive Brokers' Trader Workstation (TWS) using C++ through UNIX socket in Linux. But I can't seem to get both to work at the same time. I tried to connect to the Python server using ZeroMQ first, and then to TWS once the connection is established. But after I connect to TWS, I can't seem to interact with my original ZeroMQ connection in any way. The connection with TWS would always lose whenever I provide the ZeroMQ socket to call zmq::poll. But if I don't include the ZeroMQ socket, zmq::poll works just fine with the file descriptor from the connection to TWS. I am not too experienced with either UNIX sockets or ZeroMQ, but is it true that I can't use ZeroMQ and sockets API in the same thread? I thought it would be simple to add ZeroMQ to the original Interactive Brokers socket client, but it is more complicated than I expected. Any suggestions would be greatly appreciated.

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 get Socket connect through proxifier

I made a simple program in c++ for connecting to a site and loading a page HTML code or send data using GET/POST requests.
But now I want the program to connect and send/receive data through proxy.
You probably know software like NextVpn and proxifier. when they are running any application which tries to communicate through internet will have to go through these apps.
The problem is that my program connects and communicates directly and my proxy software doesn't interfere.
Communication is done by the socket programming routins (SOCKET class) like this
SOCKET sck=socket(AF_INET,SOCK_STREAM,IPPROTO_TCP);
connect(sck,(SOCKADDR*)(&SockAddr),sizeof(SockAddr));
send(sck,myRequest,strlen(myRequest),0);
Any solution?
EDIT: The problem was from NextVPN not the Proxifier itself. It seems that NextVPN lacks functionality in hooking into some programs. First NextVPN finds the program which is trying to connect to a remote address then redirects it to its portable version of proxifier with something named "compose.ns" . Unfortunately it was unable or couldn't detect my app connecting to internet. Instead I used Proxifier itself and it successfully detected my app as it was showing in its connection list.

C++ & Boost: I'm trying to find an example TCP program with a server that accepts connections from multiple clients

A chat program would be a good enough example.
Just need a server that can accept multiple connections from the clients, and the server needs to be able to send messages to individual clients.
I plan to turn this into a distributed computing program to work with multiple Neural Networks.
Asio is the Boost library that handles networking. There's a chat server example listed here.
I cannot give you an example progam. But to write a server things that you have to do:
1. server will listen at a port for connection
2. thread pool which will accept the connection and serve request
3. write the server code in thread safe manner
You have to use socket programming A good link for that http://beej.us/guide/bgnet/
you can use win32 api in windows and posix for linux