recv.h
Go to the documentation of this file.
1 
23 #ifndef UDP_BC_BROKER_RECV_H_
24 #define UDP_BC_BROKER_RECV_H_
25 
26 #include <iostream>
27 #include <stdio.h>
28 #include <vector>
29 #include <sys/socket.h>
30 #include <unistd.h>
31 #include <sys/types.h>
32 #include <netdb.h>
33 #include <netinet/in.h>
34 #include <arpa/inet.h>
35 #include <string.h>
36 #include <boost/function.hpp>
37 #include <boost/bind.hpp>
38 #include <boost/thread.hpp>
39 
40 using namespace std;
41 
42 namespace udp_bc_broker{
43 
44  class UdpRecver {
45  public:
46  UdpRecver(int port);
47  ~UdpRecver();
48  void receive(boost::function<void(const vector<uint8_t>&)> callBack);
49  private:
50  void process_msg();
51  boost::function<void(const vector<uint8_t>&)> callback;
52  int sock;
53  struct sockaddr_in addrto;
54  struct sockaddr_in from;
55  int nlen;
56  int len;
57  char *buf;
58  boost::thread* process_thread_;
59  };
60 };
61 
62 #endif
void callback(const vector< uint8_t > &msg)
Definition: test_recv.cpp:27
boost::thread * process_thread_
Definition: recv.h:58


udp_bc_broker
Author(s):
autogenerated on Mon Jun 10 2019 14:02:40