& quot;没有用于调用绑定的匹配功能"在使用websocketpp时 [英] "No matching function for call to bind" while using websocketpp

查看:74
本文介绍了& quot;没有用于调用绑定的匹配功能"在使用websocketpp时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在制作一个(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.

这篇关于&amp; quot;没有用于调用绑定的匹配功能&quot;在使用websocketpp时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆