Question

I was thinking about creating a certain app that deals with audio/video/chat communication. Now what is conflicting is that I need to be certain of the data transferred to be delivered (On the servers end before it reaches anywhere else). Aside from that issue I need the server to be aware of the connectivity of the client's end when trying to send messages.

So do I maintain a TCP connection between server and client for messages plus non user controlled data that needs to be updated constantly and use UDP for video/audio communication and downloads (risking data loss/corruption)?

Thanks in advance.

No correct solution

OTHER TIPS

What you describe is a pretty common approach. You can have a "control" channel over TCP, which handles data which needs the features of TCP (retransmit, data sequencing, etc.) and a "data" channel over UDP which can be lossy.

The alternative would be to define your own protocol over the UDP channel that implemented re-transmits, etc., but it's probably in your best interest just to use a control channel.

To get started, I recommend: Only use TCP (with two TCP connections; just like FTP does it for 30 years) and adjust the TCP buffers and frame-sizes to an optimum that works for you. If you (at a later time) want to get a few percent better performance, you can still switch down to UDP (with your own specialized protocol), and have the working TCP variant as a fallback alternative, in case someone/something makes the use of UDP impossible.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top