Unplug Printer Have to Put in Wifi Again

In this brief article nosotros're going to take a look at what really happens when we close downward a device's wifi or unplug the ethernet cablevision off of a estimator. While intuitively ane would await the current connections to go downwardly, this is likely not the case.
We are going to see why this happens and analyze a few misconceptions that ascend when testing disconnection scenarios in a multiplayer game.

» The disconnection mystery

Ane of the about popular bug when testing multiplayer games is trying out dissimilar disconnection scenarios and making certain that the client handles them correctly. In particular, with SmartFoxServer 2X, developers want to test reconnection cases using the HRC+ system, which reconnects clients that have lost connectedness for a brief moment.

In our HRC+ documentation nosotros already provide directions for testing these cases, simply we all knows reading the docs is boring 🙂 After all this seem very intuitive: unplugging the client's network cable should immediately trigger a disconnection. (No network must equal to no connections, no?) But this isn't the case. In fact, neither the operating system nor whatsoever application dependent on information technology (eastward.g. SmartFoxServer) volition bat an middle if we unplug the cable or wifi.

So, what gives?

» A brief peek behind the defunction

To solve the mystery we need to accept a quick look at what's behind all this, in other words how the networking infrastructure works in most computers and devices, smartphones included.

Below is a simplified representation of the 7 layers of the OSI Model, which is an open and standardized model for telecommunications and is implemented in all major operating systems, from Android to Linux and Windows.

Without going into unnecessary details, this model describes how network communications work from the electric impulses (layer 1) up to the application data (layer seven) and going through a series of transformations and encodings through each the layers.

The wikipedia page summarizes the layered structure like this:

A layer serves the layer in a higher place information technology and is served by the layer below it. For example, a layer that provides error-costless communications across a network provides the path needed by applications higher up information technology, while it calls the next lower layer to ship and receive packets that comprise the contents of that path. Two instances at the same layer are visualized as connected by ahorizontal connection in that layer.

If we take some other look at the diagram we can notice that both the TCP and UDP protocols sit down right in the center of the ladder and are separated from the physical layers, where the cable is connected (layer 2). When we unplug the cable the event is immediately detected at the link level (layer 2) but not at the higher levels such as IP (layer 3) and TCP/UDP (layer 4), where no i volition exist the wiser, and everything will continue working every bit if cipher had happened.

There is likewise a secondary aspect to keep in consideration. The TCP protocol always expects ACK (acknowledge) packets from the other end to confirm that a sure fragment of data has arrived. If no ACK is received inside a certain amount of time the TCP volition re-transmit the information. Combine this with its blindness equally to what happens at the lower levels, and we can see why unplugging the cable doesn't trigger any disconnection event.

To put information technology in unproblematic terms, TCP is a very patient protocol that can handle moments of "silence" and resend data to brand sure the other political party will eventually get information technology. In fact, if we reconnect the cable within a certain amount of time, nosotros'll be able to resume the communications as if nothing had happened and without data loss.

On the other manus the UDP protocol is a connection-less transport and as a such it doesn't require to know anything most connection or disconnection events. If we try to send UDP packets while the ethernet or wifi are unplugged the system will simply discard all those packets. Similarly any UDP data coming from a remote host to our device will be lost.

» Mystery solved

And so nosotros finally uncovered the puzzle. There are multiple levels of isolation betwixt layers of the networking model and cable/wifi unplug events happen at a different level, than those of UDP and TCP. Also the TCP was inherently designed to withstand temporary blackouts without giving upward, which explains why an unplugged cable poses no issues for all existing connections.

In determination the lesson to be learned is that pulling the ethernet cable is not a reliable way of testing a sudden disconnection scenario. More often than not nothing will happen.

So how do we simulate a normal, TCP-level disconnection? In the context of SmartFoxServer 2X and for testing the HRC+ events we explain this in our documentation and we provide a method in all supported customer API to trigger a sudden disconnection. Y'all tin can larn all the details in the linked documentation.

» Other causes of disconnections

Nosotros accept looked into physical disconnections that crave unplugging a cable or wifi, just what about other types of disconnections that can bear upon a client, such as an cyberspace hiccup or an application crash?

More often than not speaking network disconnections can happen for a host of reasons. When a device communicates with a remote server it goes through a number of so called "network hops" (or nodes) which are typically represented routers or gateways. Each router can have its own reasons (or issues) to drib a connection and that'south unremarkably what happens when we get kicked out of the internet unexpectedly. (Reasons for dropping a connection can be due to loftier traffic, unrecoverable errors, etc.)

In those cases SFS2X'southward ain HRC+ can come up to rescue past freezing the server side land of the role player and past starting a new session from client side. This way the user will just experience a short moment of intermission before jumping dorsum into the game without loosing his state.

Other situations such equally an application crash volition not be resumable as the client country is lost, which is an essential office for being able to carry on with the game. In those (hopefully rare) cases we will accept to run a new client, login and start a new game.

caballerocound1940.blogspot.com

Source: https://smartfoxserver.com/blog/what-really-happens-when-you-unplug-your-networkwifi/

0 Response to "Unplug Printer Have to Put in Wifi Again"

إرسال تعليق

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel