pans
2017-08-07 58c513f0a3abb45359972112913619fa9d613c95
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
//
// Created by pansen on 2017/8/4.
//
 
#ifndef RTSPNATIVECODEC_REMOTEFUNC_H
#define RTSPNATIVECODEC_REMOTEFUNC_H
 
#include <iostream>
#include <capnp/ez-rpc.h>
#include "RemoteMethod.proto.h"
 
//::capnp::Capability::Server
template <class T> class RemoteServer{
public:
//    RemoteServer(std::string host, int port, capnp::EzRpcServer rpcServer) : rpcServer(rpcServer) {
//        this->rpcServer(kj::heap<T>(),host, port);
//                //.rpcServer(kj::heap<T>(),host, port);
//    };
    RemoteServer(std::string host,int port):host(host),port(port){};
    ~RemoteServer(){};
 
    bool start();
    void stop();
    bool running;
private:
    std::string host;
    int port;
 
    static void *rServer_thd(void *arg);
 
    pthread_t server_thd;
    pthread_mutex_t mutexSerevr;
};
#endif //RTSPNATIVECODEC_REMOTEFUNC_H