tutorial on windows service and client? - c++

I am trying to create an application that can run as a service and another program to communicate with it (client)
i can find plenty of sample code about services but nothing about programs that interact with services
can someone please link some examples?

Sounds like you could and maybe should use TCP sockets. Or at least that would be the easiest and most straight forward.
Alternatively since it sounds like both client and service are on the same computer you could use some form of IPC (interprocess communication). So depending on your OS you may decide to use IPC instead.

Related

Commucation between a client software and a server software in C++ using multiple threads

I have a software written in C++ that is gonna work as a server for several client softwares.
So each client program is gonna make a call to the server software and then the server software is gonna start a thread to serve the client.
The server and the clients might not necessarily run on the same machine, but, in some situations, they will.
The main point here e having this server software being able to control the number of threads and calls, thus the centralization and also something that would be easy to reuse in various platforms and languages, so if I want to, I can write a Python or Java client to make a thread call and interact with the C++ server software.
I do have a C++ API built in but I do not know how I should proceed with this server/client architecture.
Appreciate any help.
If you're communicating locally I'd say the quickest suggestion is to brush up on Remote Procedure Calls. You should also be looking at sockets for connection across network between a server and a client.
These are broad topics so I would suggest that reading up on these will help you to find more direct questions than people can provide very specific answers to.

Create a web server with nodejs/http-parser

I want to create a small web server in c++ with http-parser from here nodejs/http-parser, I downloaded and I compiled what should I do next?
First of all, you need a way to communicate using TCP/IP in order to implement the HTTP server; depending on your case, you may also need to use other protocols, like UDP (for instance, if you need to resolve a domain name, you will typically use DNS) or ICMP.
If your application is running by an Operating System, take a look at its documentation about the networking facilities it can provide you. For instance, many operating systems provides a POSIX sockets API that will help you dealing with network devices and protocols.
If you prefer, you can use one of the networking libraries already written, provided they support your environment. They can help you with a useful abstraction of the network, so you can concentrate better on your application.
On the other hand, if your application will not be running by an Operating System, the first thing to do is to find some internet protocol suite that you will be able to use in your particular environment.
If you don't find one, you obviously need to implement everything by yourself.

communication between OS services with c++

I am developing 2 Windows services, one of them will send pictures and word files to other and other service will give a string answer. That services are in same computer.
I will develop same program's Linux version also.
Which way is the best for communication between services in Linux and Windows.
By the way I am developing that services with C++.
There're different options for your task:
Network. Establish TCP connection between your services, with service that asks as a client and service that answers as a server. It's possible to implement cross-platform solution using Boost.Asio or any other portable network library.
Shared memory. You can implement inter-process communication using shared memory. Cross-platform library: Boost.Interprocess.
Pipes. I don't know cross-platform library for this.
I would recommend to use TCP communication as more flexible solution.
I would suggest reading up on C++ sockets. You're probably going to want to use TCP sockets, since you want to ensure that the data being transferred does so correctly.
Try checking these links out:
Linux Sockets
Windows Sockets
You should search for IPC.
There are a lot of possibilities for inter process communication. Because you are not very specific about your problem and your requirements but I would suggest to take a look at boost::interprocess.
As long as you are sure that both services run on the same machine this will do it.
If you want to switch to a distributed approach you need something different.
Like XML-RPC, thrift or corba. Just to mention some possibilities.

How to incorporate ports / sockets for direct tunneling with p2p darknet app

I'm building an app which upon login will connect you to certain ip addresses of which will also be running the same app.
The method of which i believe i should be using is direct tunnelling but as i say im a little new to c++, i have general coding skills, and i have sifted through a lot of forums and sites yet im still very unclear on what the best way forward is to achieve the requirement.
The reason for the connection will be to enable a secure chat, file transfer, and update software auto when connected to the program admin.
All those that have the app installed will once authorised, will be connected to admin client, then from that client all available ip's to connect to will become available to slave clients, this will increase the network size avilable to all users.
so the app needs to be able to handle ports but not via a server, instead it would be direct.
The connections also must ideally be encrypted.
Im kind of looking for what the application RetroShare does, but in text app.
(This is using C++ within Dev C++)
so just to recap, What method should i use to achieve the above?
I would take a look at SDL net to start with, its really simple to learn if you have never done any socket programming before.
for a secure connection you will probably want to start with TCP and then once you get the hang of network programming, start looking at other protocols.
Hope this helped! and good luck.

What is a good implementation of a peer-to-peer chat program with a server for assigning connections in C++?

For a while, I've been interested in creating a proof-of-concept chat program using C++. I have given the idea a lot of thought and even wrote down the beginnings of how I would design the system, but I have hit a barrier in my thinking when it comes to the implementation.
I want to know what an implementation of a peer-to-peer chat client with a server to route connections would look like in C++.
The server would be used as a central registry of the peers, but not used as the primary connection. The server would not interact with the clients in any way except to assign connections between peers to achieve an optimal path between peers. In a first version, it would merely be a directory to which all clients connect, and the clients can then use the directory to connect to the other clients available for chat. (I hope that explains it a bit more). :)
You should look at the XMPP stuff. It is all about routing and co-ordinating messaging. It uses de-centralization and a peer-to-peer like architecture.
There are also plenty of open source implementations. For example,
Jabber.org
I cannot really think at something better than the chat example in
the Boost.Asio documentation. Search for the examples documentation in Boost.Asio.