21 lines
509 B
C++
21 lines
509 B
C++
#pragma once
|
|
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
|
|
class TcpNet {
|
|
|
|
public:
|
|
TcpNet();
|
|
|
|
// starts listening on port
|
|
int server(int port, std::function<std::pair<bool, std::string>(std::string)> process_request) const;
|
|
|
|
// writes request to server on address:port and returns response
|
|
std::string client(const std::string &address, int portno, const std::string &request) const;
|
|
|
|
std::vector<std::string> client(const std::string &address, int portno, const std::vector<std::string> &requests) const;
|
|
|
|
};
|