I have a question about Socket (Coding X, Concept related question)

Asked 2 years ago, Updated 2 years ago, 93 views

Hello!

I think I often post questions while studying various concepts recently. (I think I'm posting too much, and I'm sorry, so if I post it on Facebook's life coding group, it's hard to find it later, so I'm posting it here.))

I was learning the concept of sockets today!

Socket is a two-way communication technology that can solve HTTP's shortcomings. " That's the explanation of most blogs. I read the other contents and understood the socket, but I don't know if it's accurate, so I'm asking you a question!

Um... if I were to express it in a picture

On the left, when sending data using HTTP, http wraps the data and puts a header on it, tcp headers on it, and ip headers on it, wraps it around it, and then majors in data.

The figure on the right shows when the socket was used. However, in order for data to enter into TCP, I understood socket communication as an interface to wrap the data around TCP. The reason why I thought like this is because on a blog, the header of HTTP is large (relatively), but if you use a socket, you can reduce it considerably, so I understood, "Oh, then if you use a socket, you don't use http." And I drew it like that.

Please check if what I understand is correct!

And... It's a very stupid question, but... Are sockets and web sockets different...?

socket

2022-09-21 18:43

1 Answers

If you use TCP immediately, you can say that you do not use HTTP. It's fast, but it needs to be implemented one by one.

WebSocat was forced to send and receive data only at the request of the client, and to improve this, it also provides aSocat in the web environment from HTML5. It allows you to send data from the server to the client like a regular socket, creating a more dynamic web environment


2022-09-21 18:43

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.