This commit is contained in:
Erik Frojdh
2019-06-05 17:45:02 +02:00
parent 6c64bdb04a
commit e46f3f9a2c
2 changed files with 9 additions and 4 deletions

View File

@ -4,6 +4,8 @@
#include <iostream>
#include "container_utils.h"
constexpr size_t MB = 1048576;
int main(int argc, char **argv) {
std::cout << "Test server\n";
int port = 2345;
@ -18,14 +20,14 @@ int main(int argc, char **argv) {
std::cout << "Listening to port: " << port << "\n";
auto server = sls::ServerSocket(port);
auto data = sls::make_unique<char[]>(5000);
auto data = sls::make_unique<char[]>(1*MB);
while (true) {
try {
auto socket = server.accept();
auto val = socket.receive<long>();
std::cout << "Value: " << val << "\n";
std::cout << "Read: " << socket.receiveData(data.get(), 5000) << " bytes";
std::cout << "Read: " << socket.receiveData(data.get(), 1*MB) << " bytes";
} catch (const sls::RuntimeError &e) {
}