I just couldn't fit all of it in the title, actual title is:
How to send and receive messages (data packets) between UI and the server. And what would be most minimalistic CLI Linux edition that would only be able to receive and send such data and also perform "basic" tasks.
Phew, I would like to learn how servers and user desktops/browsers can communicate to one another. For example, when I log in browser on my Gmail, it sends these data to servers, then looks up whether they're correct. If I use Dropbox, and put file in the folder of Dropbox, it will connect to their servers and send name, content of the file and such to them.
All of these require server running, machine somewhere deep in darkest places where noone lives. Take that query, parse it, execute it accordingly, and eventually send data back.
I'd prefer using C++, since it is quite low-level. Such code in C# would be:
using System.Net; string url = "example.php?script=true"; HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); HttpWebResponse response = (HttpWebResponse)request.GetResponse(); Stream resStream = response.GetResponseStream();
I don't expect you to give me ready code, but couple links that would explain situation would be good. Googling "how to send"... uh... this is where I get stuck, I don't even know how it's called. Both client and server will be Linux. I'd love to have it done in
HTTP but later I'll buy some SSL certificates). Because output like:
HTTP/1.1 200 OK Date: insert date here Content-Length: 0 \r\n
Is so easily parsed. I Googled "how to send HTTP request" or receive it. I met those links, but I'm still not sure about them and I'd like to ask certain questions:
One of the answers said: "On Linux, I tried cpp-netlib, libcurl, curlpp, urdl, boost::asio and considered Qt (but turned it down based on the license). All of these were either incomplete for this use, had sloppy interfaces, had poor documentation, were unmaintained or didn't support https.", does that mean that Qt (if I'll finally learn completely how to use it) has already something in it that might me get on my way to send HTTP requests? People are telling that C++ has no built in network compatibility (look first two answers) so it needs premade libraries for it. He finally decided to use POCO, which isn't a good choice as far as I think. In case if it's not maintained and someone will find out, they will find out a hole in it. I'd rather use pure C++ or more known and trusted library. Even when it's targeted more, it surely is also more protected.
On this website, Qt is mentioned. Once again, that's another hint Qt might just have something that I need to send and receive HTTP requests. Maybe even HTTPS.
This one provides lots of examples, but they're "too ready", they involve around ready examples that transfer files between client and servers, what I'd want to achieve is sending them by pure text, something like:
HTTP/1.1 200 OK
Of course more protected, but I don't want to send entire files there and back, I just want to be able to send and receive strings. It also mentioned an example of uploading and downloading files with Qt, but once again, I'm not about sending and receving files, but sending and received strings (favoribly HTTP requests).
There's quite an amount of links I visited, but questions involve the same. The second question (yes, second, not twentieth). What would be a good Linux distribution to do that? Yes, I could download every single distribution, delete the DE, strip it down to it's shell, and then manage to get run-time libraries and all dependencies on it. But isn't there someone that already did this before me? Is there no official CLI-only server-ment Linux distro, one that would be able to run
.cpp compiled applications, receive the HTTP request and content, send the HTTP request and content, write the file, delete the file, edit the file, give me time and date, and just the "normalest" Linux functions, math, partition management, disk check, just, Linux etc. ?