C++ server/client 网络

C++ server/client networking

我正在从事一个项目,该项目将包括一个服务器和一个客户端组件,它们将 send/receive 通过 TCP/IP 请求/信息。服务器组件将使用 C++ 开发,我将使用 boost.asio 库。客户端组件将是一个 excel 插件,将在 Visual Basic 中开发。我有几个一般性问题,请注意,我不希望在这里得到任何具体答复,但希望听到一些概念,以便我可以专注于此。

我的问题如下。

  1. 服务端和客户端会用不同的语言开发,两种开发语言之间的socket通信有什么需要担心的吗?

  2. 我希望应用程序通过与 LDAP 系统集成而具有 login/authentication 机制。是否有任何 c++ 库可用于此目的? (比如 TCP 的 boost.asio

  3. 有没有什么概念可以建议在c++中进行用户会话管理

  4. 作为我的应用程序的一部分,需要将数据从服务器传输到客户端,反之亦然。此数据有时可能像数百到数千行和数百列。通过套接字传输此类数据的最佳方式是什么?数组对此有好处吗?

我知道我的问题非常高级和基础,但您的回答将为我指明正确的方向,并帮助我专注于正确的概念。

提前致谢。

  1. The server and the client will be developed in different languages, is there anything to worry about socket communication between two developing languages?

不一定,只要您有明确定义的线路格式即可。要么使用现有的,例如 HTTP/JSON,要么自己明确定义。当界面稍微复杂一点时,可以考虑使用CORBAICE.

之类的东西
  1. I want the application to have login/authentication mechanism through integration with LDAP systems. Is there any c++ libraries that I can use for this purpose? (like boost.asio for TCP)

OpenLDAP 有一个 C++ API。我没有这方面的经验,所以这里没有推荐或警告。

  1. Is there any concept that you can suggest user session management in c++

这取决于你需要什么。最简单的方法是按年龄排序的会话对象的共享指针向量,但是当进程重新启动时,这些会话都将无效。 memcached 中的会话在进程重新启动后仍然存在。当你想在机器重启后存活时,我更喜欢关系数据库中的会话数据,或者文件。

  1. As part of my application, there will be need to transfer data from the server to the client or vice versa. This data can sometime be like hundreds to thousands rows with hundred of columns. What is the best way to transfer such data through sockets? Is arrays good for this?

您可以为每个对象使用简单的格式并简单地流式传输对象。例如。 CSV,或 JSON。当您的大部分信息还不是文本时,还可以考虑二进制固定格式。当然,什么是最好的取决于数据类型。