简体   繁体   English

使用Web套接字的客户端-服务器通信

[英]Client-Server Communication Using Web Sockets

I'm developing a Client application which talks to a Server using WebSockets. 我正在开发使用WebSockets与服务器通信的客户端应用程序。 The Client is in C++ and the Server is in Java. 客户端使用C ++,服务器使用Java。

Can anyone suggest me any library which I can use on both Client side and Server side for communication using web sockets. 谁能建议我可以在客户端和服务器端使用Web套接字进行通信的任何库。

I never had experience with WebSocket, but try library cURL (libcurl). 我从来没有使用过WebSocket的经验,但是尝试使用库cURL(libcurl)。 It was easiest for me to write clients for HTTP and FTP, using it. 对我而言,使用它编写HTTP和FTP客户端最简单。 It have to help (but curl is useful just for clients, not for server). 它必须有所帮助(但是curl仅对客户端有用,对服务器不有用)。

If you are talking about sockets, normal sockets that connect on a port and wait for a connection on the server side and that connect to a given address on the client side, then I would recommend the boost asio socket on the c++ side and the standard java socket on the java side. 如果您谈论的是套接字,即在端口上连接并等待服务器端连接的普通套接字,并在客户端连接到给定地址的套接字 ,那么我建议在c ++端使用boost asio套接字 ,而在标准 端口Java端的java 套接字

Just remind yourself of making sure that you transmit the datatype you expect. 只是提醒自己,请确保您传输所需的数据类型。

Another cool implementation for both, java and c++, is ZeroMQ . Java和c ++的另一个很酷的实现是ZeroMQ I would recommend to take a look at it because it is easy to use and has implemented some really cool communication patterns. 我建议您看一下它,因为它易于使用并且实现了一些非常酷的通信模式。

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

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