Hi,
I think you are confused about
HTTP and Socket .
HTTP protocol is a non-persistent, one-way network protocol that allows the server to return the appropriate data only after the browser has made a request to the server to establish the connection.
HTTP connection using the "request - response" approach.
HTTP is a short connection: the client sends the request needs to send back the server response, after the request is completed, it takes the initiative to release the
connection.
Socket is wrapped the TCP / IP protocol , Socket is only an interface is not a protocol, we can use Socket TCP / IP protocol, in addition to TCP, you can use the UDP protocol to transfer data.
Socket is a long connection: Once the Socket connection is established, the two parties in the communication start to send each other's data until they are disconnected.
In many cases, it is necessary to actively push data from the server to the client and keep the client and the server in real time.
If the two sides are Socket connection, the server can send data directly to the client.
If the two sides are HTTP connections, the server needs to wait for the client to send the request before the data can be returned to the client.
Therefore, the client sends requests to the server regularly, not only can stay online, but also ask the server whether there is new data, if there is data to the client.
Sincerely,
Bob
MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to
MSDN Support, feel free to contact MSDNFSF@microsoft.com.