tcp-server and tcp-client added
This commit is contained in:
20
clib/tcpnet.h
Normal file
20
clib/tcpnet.h
Normal 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);
|
||||
|
||||
};
|
||||
Reference in New Issue
Block a user