I need to send information from a cpp program to a webbrowser-based javascript program running on a local machine. One method I was considering was to have the cpp program send the data to a localhost socket, and have js picks it up at that specified port, using jquery and json or ajax or whatever. Is it possible, or is there a better method?
You could set up a websocket server in c++, and send the data that way.
If its a small amount of data and timing isn't a huge issue, I would probably just write out to a .txt in c++, and then poll that file with javascript.
您可以制作一个cgi-script ,并对该程序进行AJAX调用。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.