working commit

This commit is contained in:
Олег Бородин
2026-05-05 11:37:10 +02:00
parent bd4df1e3da
commit eda9b8986b
62 changed files with 7546 additions and 476 deletions
+32
View File
@@ -0,0 +1,32 @@
#include <expected>
#include <string>
#include <vector>
#include <span>
#include <iostream>
#include <tcpclient.hpp>
int main( int argc, char** argv) {
TCPClient client;
auto res = client.Connect("209.51.188.116", 80);
if (!res) {
std::cerr << res.error() << std::endl;
return 1;
}
auto wSize = client.Write("GET / HTTP/1.1\n\n\n");
if (!wSize) {
std::cerr << wSize.error() << std::endl;
return 1;
}
std::string buffer;
auto rSize = client.Read(buffer, 8);
if (!rSize) {
std::cerr << rSize.error() << std::endl;
return 1;
}
std::cout << std::format("read {} bytes", rSize.value()) << std::endl;
std::cout << std::format("{}", buffer) << std::endl;
}