Finding a good way to transfer critical data in real time over the Internet

I am looking for a good method for transferring data over the Internet, and I work in a C ++ / windows environment. Binary data, compressed frame of the extracted image. Entrance and requirements are as follows:

  • 6kB / packet @ 10 packets / sec (60 Kbytes per second)
  • Reliable data transfer

I am new to network programming, and so far I have been able to understand that one of the following methods is suitable.

  • Sockets
  • MSMQ (MS Message Queuing)

The client works in the browser (displays images in real time in the browser). While the server runs its own C ++ code. Please let me know if there are other ways to achieve this? What should I go and why?

+4
source share
3 answers

If the server determines the pace at which the images are sent, how it looks, a style decision on the server makes sense. That most browsers (and even non-browsers) are settling for these days, WebSockets .

The main advantage of WebSockets for most proprietary protocols, in addition to becoming a widespread standard, is that they work on top of HTTP and thus can penetrate (most) proxies and firewalls, etc.

On the server side, you can potentially integrate node.js , which makes WebSockets easy to implement, and comes with many other libraries. It is written in C ++ and extends through C ++ and JavaScript, in which node.js hosts the VM. node.js main function is asynchronous at every level, which makes this default programming style.

But of course, there are other ways to implement WebSockets on the server side, perhaps node.js is more than you need. I implemented the C ++ extension for node.js on Windows and used socket.io to port WebSockets and non-WebSocket for older browsers, and it worked fine for me.

But it was text data. In the case of binary data , socket.io will not do this, so you can check out other libraries that make binary through WebSockets.

+3
source

Is there any specific reason why you cannot start the server on your Windows machine? 60kb / seconds, looks like some kind of built-in device?

Based on our description, you can display real-time image information in a browser. You can use HTTP. but its statelessness, that is, when information is transmitted, you lose connection. You should poll the C ++ / Windows machine. If you are sure that the information generated is periodic, you can use this approach. This requires a server, so only if yes to my first question

Chat Protocol Something like the Jabber client running on your client and the Jabber server on your C ++ / Windows computer. Chat protocols allow in almost real time

+2
source

Although this may seem to make sense, I would not use MSMQ in this scenario. Because of this, you may not run into a problem, but MSMQ messages are limited in size, and because of this, you can get into the wall.

I would use TCP for this application, TCP is built with reliability, and you can simply transfer data through a socket. You may need to draw up a simple protocol yourself, but this should be the best choice.

If you are not using a built-in device that understands MSMQ out of the box, the best choice for using MSMQ is to use a proxy server, and you still have to play with TCP and possibly HTTP.

I do home automation, which includes security cameras in my personal time, and I use the .net micro infrastructure, and even if it has MSMQ capabilities, I still won’t use it.

I recommend you check out MJPEG (Motion JPEG), which sounds exactly the same as you would like.

http://www.codeproject.com/Articles/371955/Motion-JPEG-Streaming-Server

+2
source

Source: https://habr.com/ru/post/1441207/


All Articles