问题描述
我正在制作一个(c ++)应用程序,它是一个websocket客户端和websocket服务器.为此,我使用了websocketpp库.为了使应用程序既是客户端又是服务器,我希望 endpoint1.run()
和 endpoint2.listen(port)
是多线程的.这是出问题的地方.
I'm making an (c++) application which is a websocket client and websocket server. To be able to do this, I'm using the library websocketpp. To make the application both a client and server, I want the endpoint1.run()
and endpoint2.listen(port)
to be multi-threaded. This is where something goes wrong.
通常(单线程)我使用: endpoint.listen(port);
起作用.
Normally (single thread) I use: endpoint.listen(port);
which works.
要使其成为多线程,我使用:
To make it into a multi-thread I use:
boost::thread t(boost::bind(&server::listen, &endpoint, port));
sleep(1);
cout << "After thread! \n";
t.join();
但是,我得到了错误:
main.cpp:116:错误:没有匹配的函数可用于调用"bind(<未解析的重载函数类型>,websocketpp :: server *,uint16_t&)"
server :: listen
是一个重载函数,在绑定中我应该以不同的方式调用它吗?
server::listen
is an overloaded function, should I call it differently in bind?
推荐答案
看看升级文档.有一个很好的例子.
您需要自己解决歧义.
Take a look at the boost documentation. There is a good example.
You need to resolve the ambiguity by your self.
这篇关于& quot;没有用于调用绑定的匹配功能"在使用websocketpp时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!