diff options
author | pks <pks@users.noreply.github.com> | 2019-05-12 20:10:37 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-12 20:10:37 +0200 |
commit | 4a13b41700f34c15c30b551f98dbea9cb41f67c3 (patch) | |
tree | 0218f41c350a626f5af9909d77406309fa873fdf /decoder/local.cc | |
parent | e9268eb3dcd867f3baf67a7bb3d2aad56196ecde (diff) | |
parent | f64746ac87fc7338629b19de9fa2da0f03fa2790 (diff) |
Merge branch 'net' into origin/net
Diffstat (limited to 'decoder/local.cc')
-rw-r--r-- | decoder/local.cc | 51 |
1 files changed, 0 insertions, 51 deletions
diff --git a/decoder/local.cc b/decoder/local.cc deleted file mode 100644 index b03fd17e..00000000 --- a/decoder/local.cc +++ /dev/null @@ -1,51 +0,0 @@ -#include <iostream> -#include <sstream> -#include <stdio.h> -#include <unistd.h> - -#include <nanomsg/nn.h> -#include <nanomsg/pair.h> -#include "nn.hpp" - -using namespace std; - -void -recv(nn::socket& sock) -{ - char *buf = NULL; - sock.recv(&buf, NN_MSG, 0); - if (buf) { - string translation(buf); - cout << "received translation '" << translation << "'" << endl; - } -} - -void -send(nn::socket& sock, const string& msg) -{ - cout << "sending source '" << msg << "'" << endl; - sock.send(msg.c_str(), msg.size()+1, 0); -} - -void -loop(nn::socket& sock) -{ - int to = 100; - sock.setsockopt(NN_SOL_SOCKET, NN_RCVTIMEO, &to, sizeof(to)); - while(1) { - send(sock, "das ist ein test ."); - sleep(1); - recv(sock); - } -} - -int main(int argc, char const* argv[]) -{ - nn::socket sock(AF_SP, NN_PAIR); - string url = "ipc:///tmp/network_decoder.ipc"; - sock.connect(url.c_str()); - loop(sock); - - return 0; -} - |