#include "Nng/Socket.h"
#include <cstring>
#include <iostream>

int main(int argc, char const *argv[]) {
    using namespace Nng;

    if (argc < 2) {
        std::cout << "arg size: " << argc << std::endl;
        return -2;
    }

    Socket request(Request);

    std::error_code error;
    request.dial("tcp://172.16.104.70:33892", error);
    if (error) {
        std::cerr << error.message() << std::endl;
        return -1;
    }

    request.send(argv[1], strlen(argv[1]));

    auto buffer = request.recv();
    std::cout << buffer.data() << std::endl;
    return 0;
}
