Answer the question
In order to leave comments, you need to log in
What is an internet connection?
Once at the university, I wrote a pseudo-chat using wine sockets.
So, as I was told, once connected, the client has a " persistent connection " with the server.
And when a certain event occurs, the server sends a message to a certain thread.
In my head - "continuous connection" is presented as a stream of water that continuously flows, and in both directions, and when necessary, a grain of sand (message) is slipped there.
But can the "Internet connection" be physically continuous?
I wonder: What is meant by the word "continuous"?
Answer the question
In order to leave comments, you need to log in
The closest analogy is: you open a chat with a friend and chat for 20 minutes. Despite the fact that you sent a lot of messages to each other, they were all sent within the same conversation, and you consider them connected. They were sent as part of this continuous connection-conversation. "Under the hood" at this time, many different things can happen. For example, to write a message, you need to take your phone out of your pocket, unlock the screen, open the chat application, select the interlocutor, click on the message input field, press the letters of the on-screen keyboard one by one. The phone, also somewhere under the hood, does a lot of things to ensure that you can talk to a friend. But these details do not distract you, and you think that you are just talking to a friend. You have a continuous 20-minute connection-talk,
The same can be said about the continuous connection between the client and the server. It consists of separate messages and a bunch of gestures under the hood, but is abstractly perceived as one connection, because all these small accompanying gestures are not essential. But, in fact, at the lowest level, there is simply a periodic exchange of signals and their processing. There is no continuity there at all.
My answer is no, it's not a "continuous flow" but just some state that is fixed in the nodes of the network.
This state changes with each data block sent. These data blocks themselves are encoded in a certain way and transmitted through some kind of physical channel.
At the network level, these are quite discrete messages.
At the physical level, this is a continuous stream of signals, but not necessarily, as there are IP over Avian carriers
. We look at the levels:
A stream (in the sense of a stream of bytes) is nothing more than a convenient abstraction.
At the level of the IP protocol, data is routed (transferred from node to node) in separate packets, independently of each other.
The UDP protocol leaves it as it is - each datagram will be a separate packet. As a consequence, there is a non-zero chance that some datagrams may get lost, or arrive in a different order than they were sent.
The TCP protocol implements the "byte stream" abstraction. Roughly speaking, in addition to the transmitted data, it inserts a checksum and a number into each packet. This way the recipient can check the integrity of the package, and reassemble the packages in the correct order. If a packet is missing or damaged, the recipient can request that the packet be resent. All this happens "under the hood" of the TCP protocol, so the application that works with it does not have to think about it. From his point of view, the data sent by the other side comes to him in the same order in which they were sent - or he receives an explicit transmission error notification.
Establishing a connection is only required to "negotiate" packet numbering and other transmission details, i.e. set the initial state.
Depending on the protocol and the OSI layer, resources are simply reserved for information transfer.
For example, an https session is set in https (a secret is generated for the session, the server stores the session ID, the client uses it to communicate with the server within the session)
At a higher level, this can be, for example, a reserved port so that the server knows where to send the response.
This is not a continuous connection, it is, roughly speaking, a dedicated channel between one and another application that exists for some time.
In terms of TCP / IP (on which the Internet is built) and sockets (in software terms, how applications communicate with each other) something like this: the server listens on a specific port, and the client sends a message to the server indicating the IP address and port. The server receives the message (because it is constantly listening on the port) and processes it in a certain way. For example, the web server receives from the client something like "GET https://habr.com/ru/auth/checklogin/ "
And sends back "200 OK" and then all sorts of headers and page content.
And already how data is processed between the client application and the server application, you need to study the OSI model, it's like a nesting doll - at one level, some data is added to others, on the other more ... on the other side, in the reverse order, each component takes them and processes them (router one, the network driver is another, the OS itself is something else, the web server is another ...). Well, the very functioning of TCP / IP needs to be studied. And this is not fit in a hundred lines. This is 1-2 thousand pages.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question