简体   繁体   English

HTML5 Socket.IO是否在C ++中可用?

[英]Is HTML5 Socket.IO available in C++?

I have a server that creates a websocket . 我有一个创建websocket的服务器。 I'm using HTML5 , Javascript and JQuery on the client side. 我在客户端使用HTML5JavascriptJQuery

My fellow-student who works on the project uses RFID technology to scan a tag. 我在该项目上工作的同学使用RFID技术扫描标签。 Then he needs to send me those data from his app via the socket. 然后他需要通过套接字从他的应用程序发送给我这些数据。

Is that possible with his preferred language C++ ? 这可能与他的首选语言C ++有关吗? And how does he need to do that? 他怎么需要这样做?

There are some websocket implementations for C++ available. 有一些可用于C ++的websocket实现。 See http://en.wikipedia.org/wiki/Comparison_of_WebSocket_implementations Unfortunately I don't have experience with any of them. 请参阅http://en.wikipedia.org/wiki/Comparison_of_WebSocket_implementations不幸的是,我没有任何经验。

When none of these libraries works out for you, I would not recommend that you create your own implementation of WebSocket. 当这些库都没有为您服务时,我不建议您创建自己的WebSocket实现。 It's not a very simple protocol (I know what I am talking about - I wrote a websocket server in Java) and it only makes sense when the client is a web browser. 这不是一个非常简单的协议 (我知道我在说什么 - 我用Java编写了一个websocket服务器),它只在客户端是Web浏览器时才有意义。 When the client is able to use pure TCP/IP sockets, like a client written in C++, there is no reason to add WebSocket as another layer of indirection. 当客户端能够使用纯TCP / IP套接字(如用C ++编写的客户端)时,没有理由将WebSocket添加为另一个间接层。

So you should rather implement an alternative network handler on your server which listens to a normal non-web socket. 因此,您应该在服务器上实现备用网络处理程序,该处理程序侦听普通的非Web套接字。 That would be a lot easier and also reduce protocol overhead and CPU load on client and server. 这将更容易,并且还减少了客户端和服务器上的协议开销和CPU负载。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM