tcp-server/client a bit improved
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
|
||||
class TcpNet {
|
||||
@@ -9,12 +10,11 @@ public:
|
||||
TcpNet();
|
||||
|
||||
// starts listening on port
|
||||
int server(int port, std::function<std::pair<bool, std::string>(std::string)> process_request);
|
||||
int server(int port, std::function<std::pair<bool, std::string>(std::string)> process_request) const;
|
||||
|
||||
// writes content to server on address:port and returns response
|
||||
std::string client(const std::string address, int port, const std::string &content);
|
||||
// writes request to server on address:port and returns response
|
||||
std::string client(const std::string &address, int portno, const std::string &request) const;
|
||||
|
||||
// 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);
|
||||
std::vector<std::string> client(const std::string &address, int portno, const std::vector<std::string> &requests) const;
|
||||
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user