Answer the question
In order to leave comments, you need to log in
How is data transmitted via socket?
As I understand it, to connect to the server using a socket, you just need to create it, but what if the program transmits different data at the same time, such as voice and text? It turns out that 2 class sockets are created, which are connected to one server?
ps I apologize if the question is stupid and all that, but this topic is very interesting to me.
Answer the question
In order to leave comments, you need to log in
Implementation dependent. You can send everything through one socket. Establish a TCP connection, send a packet header specifying the type of data (voice or text) and the size of the data, then transmit the data itself.
On the other hand, the server will receive the header, see how much data to receive after it, receive the data itself and wait for a new header.
How is data transmitted via socket?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question