简体   繁体   English

将数组从C ++应用程序发送到webApplication

[英]send array from c++ application to webApplication

i want to send one array from my Desktop application (c++) to another Web application(browser-based) which is written in javascript. 我想将一个数组从我的桌面应用程序(c ++)发送到另一个用JavaScript编写的Web应用程序(基于浏览器)。 What is the standard approach to do this ? 这样做的标准方法是什么? my purpose just is to try send array through websocket to a simple web application. 我的目的只是尝试通过websocket将数组发送到一个简单的Web应用程序。 i am a little familiar with node.js but i dont know is it possible to use it inside c++ application or not. 我对node.js有点熟悉,但是我不知道是否可以在c ++应用程序中使用它。

I want to send one array from my Desktop application (c++) to another Web application(browser-based) which is written in javascript. 我想将一个数组从我的桌面应用程序(c ++)发送到另一个用JavaScript编写的Web应用程序(基于浏览器)。 What is the standard approach to do this ? 这样做的标准方法是什么?

Your question is too broad, or shows some misconceptions about desktop applications and web applications. 您的问题过于笼统,或者显示出对桌面应用程序和Web应用程序的一些误解。

Be sure to understand (in details) HTTP and reason in terms of HTTP requests and responses (including those initiating a websocket connection). 一定要了解 (详细) HTTP 和原因方面 HTTP请求和响应 (包括发起WebSocket连接) Remember that a websocket is above some HTTP connection.... Understand the role of HTTP cookies . 请记住,websocket在某些HTTP连接之上。...了解HTTP cookie的作用。


You could change your desktop application into a web application (perhaps running on http://localhost/ ...), but that requires some significant work and redesign. 您可以将桌面应用程序更改为Web应用程序(也许在http://localhost/ ...上运行),但这需要进行大量工作并重新设计。 You probably then want to use some HTTP server library, like Wt or libonion (it supports Websockets ). 然后,您可能想要使用一些HTTP服务器库,例如Wtlibonion (它支持Websockets )。

Perhaps you might improve your web application to make AJAX requests (eg to some http://localhost:34567 ...) to you local application transformed into a specialized web sever running locally (and also using websockets, if you need that). 也许您可以改进Web应用程序以向本地应用程序发出AJAX请求(例如,向某些http://localhost:34567 ...发出请求),并将其转换为在本地运行的专用Web服务器(如果需要,还可以使用websocket)。

Perhaps you want your Desktop application to also become an HTTP client. 也许您希望您的桌面应用程序也成为HTTP客户端。 You then need some HTTP client library (like libcurl or QtNetwork ). 然后,您需要一些HTTP客户端库(例如libcurlQtNetwork )。

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

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