tcp-server and tcp-client added

This commit is contained in:
2021-10-31 09:53:48 +01:00
parent 80d7935974
commit 159845bb9b
11 changed files with 235 additions and 14 deletions

20
clib/tcpnet.h Normal file
View File

@@ -0,0 +1,20 @@
#pragma once
#include <string>
class TcpNet {
public:
TcpNet();
// starts listening on port
int server(int port, std::function<std::pair<bool, std::string>(std::string)> process_request);
// writes content to server on address:port and returns response
std::string client(const std::string address, int port, const std::string &content);
// TODO add support for vector of strings to be sent to server
// std::vector<std::string> client(const std::string address, int port, const std::vector<std::string> &content);
};