7

I've read the in a LAN the data is transmitted in packets so as to allow only one station to transmit at a given time, so how could this be applied in video games LAN parties if only one device is going to transmit at a given time ?

Data are usually transmitted in packets. Because the medium is shared, only one station at a time can transmit a packet.

Stalling, Data and Computer Communications, 5th ed.Pearson

  • 6
    It's worth noting that the premise is incorrect for most modern wired networks; "Because the medium is shared, only one station at a time can transmit a packet." held true for 10BASE2 and partially for 10BASE-T with repeater hubs. But modern Ethernet is always used as store-and-forward switches and many stations can be transmitting at any one time. – marcelm Mar 18 '18 at 16:43
  • 3
    (1) Wm. Stallings' name has an 's' on the end. (2) In other news, movies/cinema and television/video consist of a series of still images. How is it possible that still images could look to humans like they are moving? Think about it. – dave_thompson_085 Mar 19 '18 at 10:41
  • LAN Doom worked pretty well even twenty years ago on 10base2 coaxial networks, although early versions sent a packet for every chaingun bullet which caused problems. – pjc50 Mar 19 '18 at 11:10
  • @marcelm, Wi-Fi is now King of the LAN (more devices ship with Wi-Fi interfaces than with ethernet interfaces), and it uses a shared, half-duplex medium. – Ron Maupin Jun 14 '18 at 4:37
20

Only one device is allowed to transmit at any given time. At any other given time, another device is allowed to transmit.

How can you have a conversation at a dinner table if only person can speak at any time?

  • 3
    Yes, either you wait (and for real-time protocols you generally make sure that the frames are really small, so that you don't have to wait long) or you don't use a shared medium, then this problem just doesn't exist. Honestly, the last time I was at a LAN party that actually used a shared medium was in 1995. Since then, we always used switches. – Jörg W Mittag Mar 17 '18 at 23:34
  • 2
    To extend the dinner table analogy, yes if there are a dozen people at the table, it is quite possible that you may end up not being able to say what you wanted to say. Which is why enterprise LANs have to use switches - the CSMA shared medium is a non-starter in large ethernet LANs. Before ethernet switches became affordable, there were other standards (like Token Ring and 100VG) which replaced the CSMA/CD scheme with a token scheme, which means that every speaker got a time slot (token) in which they got a democratic opportunity to say whatever they wanted to say. – mere3ortal Mar 18 '18 at 3:21
  • 9
    @eis3nheim yes. But the lag is less than you can perceive. A small packet on a fast network takes microseconds to transmit. – hobbs Mar 18 '18 at 3:55
  • 1
    @eis3nheim: For example, for Gigabit Ethernet, the minimum slot time (the smallest frame a device is allowed to send) is ~4µs (512 byte). Speaking in gaming terms, that is a lag of about half a frame at 120fps. And technically speaking, GigE doesn't even need a minimum slot time, since no shared medium GigE equipment has ever been built. 10G and up don't even specify shared medium any more, and thus don't have a minimum slot time. So, this means, on GigE, if your game only ever sends the smallest possible datagrams, then lag will be about 1 frame at 120fps to get an answer back. – Jörg W Mittag Mar 18 '18 at 6:44
  • 1
    ?? Half a video frame is 4 ms (4 000 µs) – Qsigma Mar 18 '18 at 14:29
18

Some LAN protocols, on some media, are half duplex. That means that only one host on a LAN can send a frame at any given time. The classic example of this is the original ethernet, but the modern example is Wi-Fi.

The original ethernet ran on coax, and it used CSMA/CD (Carrier Sense Multiple Access with Collision Detection) to detect collisions where two hosts were sending at the same time, and it would then send a jamming signal because the data were corrupt. Each host would back off a random time and try to resend, but hosts first listened to the medium to see if any other host was sending.

Today, Wi-Fi uses a shared medium: the airwaves. Only one host at a time can send. Wi-Fi uses CSMA/CA (Carrier Sense Multiple Access with Collision Avoidance) to try to avoid collisions.

In human terms, each frame used on the medium is fairly small, and it doesn't stay on the medium very long, so by taking turns and sharing the medium, the hosts appear, to us slow humans, to simultaneously using the medium.

  • "half duplex" applies to a link, not the whole network... – rackandboneman Mar 18 '18 at 22:42
  • @rackandboneman, I don't understand the reason for your comment. I did not mention, nor imply, anything about the whole network. I was talking about the medium in use, which implies the link. – Ron Maupin Mar 18 '18 at 22:47
  • rackandboneman what we call a link now used to be called a network. @RonMaupin you said LAN, LAN = Local Area Network – immibis Mar 19 '18 at 4:35
  • 2
    @immibis, the term LAN is used in different contexts. It can mean a collision domain (link), a broadcast domain, a wiring plant in a single site (including several layer-3 networks), a campus network, etc. In the context of this question, I was using LAN to refer to the collision domain. – Ron Maupin Mar 19 '18 at 4:39
  • Of course, for a client-server game (most games these days), the "problem" is back - the minimum latency is determined by how much data the server needs to process, as well as the network infrastructure between the clients and sever. Full-duplex can help, or not at all. And yes, the server can have a better link than the clients. But in any case, we're still talking about latencies that are nowhere near the length of a single game update (on LAN) and most network games expect the message to be processed in some future update, allowing all the machines to be kept in sync despite the lag. – Luaan Mar 19 '18 at 12:07
5

The (naive) answer is, or rather used to be, simple: It tranlates to each sender having to wait a tiny fraction of a second. There is no way around this because that's how the network works at a physical level, but it is also not very much of a problem since we're talking about a few microseconds (micro, not milli).

The somewhat less naive answer would be that unless LAN also includes WLAN, your quote is outdated (wrong). On a WLAN, you still do not have many options. While one station is sending, no other station can send (unless they use a completely different non-overlapping channel, but that's really two networks, not one, so one would be cheating).

Computers in a modern "gaming" LAN will typically be connected via at least 100BASE-TX, more likely 1000BASE-T, both of which support full-duplex operation to begin with. This means you can send and receive on the same physical cable (well, a different wire within the cable, but still) at the same time. The notion of having to wait while the cable is busy is therefore not so clean-cut any more, since sending doesn't really interfere with receiving any more. Only the traffic coming from multiple other senders independently interferes.

Further, the cables will nowadays almost without exception be plugged into a switch (rather than a hub) which can, in principle (depending on the quality of the hardware) send and receive independently on every port at the same time, and which in principle (again, depending on the quality of the hardware) has enough internal bandwidth to process N times the maximum theoretical throughput for N ports. Your mileage may vary slightly since switch quality varies. Some very cheap switches will have N ports but only enough bandwidth corresponding to half as much data as can be pushed through N ports at the same time. Often, even that is (surprisingly) perfectly good enough.

Thus, you will still have some occasional, inevitable delays due to packets having to be queued when two computers in the network send at almost-the-same time to the same destination (the switch then makes that decision, not your computer's network card), but for the most part it will "just work". Note that even when it doesn't "just work", it works anyway, only just it takes a microsecond or two longer for the data to be received.

2

That book is a bit dated, check out some information on how Ethernet evolved and the difference between half-duplex and full duplex:

https://en.wikipedia.org/wiki/Ethernet#Evolution

  • 1
    Today, Wi-Fi is still half duplex, and more devices are shipping with Wi-Fi interfaces than devices with ethernet interfaces, so half duplex is alive and well. – Ron Maupin Mar 18 '18 at 1:26
  • That's definitely fair. Thinking about a LAN party though I think wired connections. – boomi Mar 18 '18 at 3:18
  • @RonMaupin With advances in MIMO technology, the limitation of one transmitting station at any one time is also fading for Wi-Fi ;) – marcelm Mar 18 '18 at 16:44
  • 1
    @marcelm, it is half duplex because a station cannot both send and receive at the same time. – Ron Maupin Mar 18 '18 at 16:47
  • More than a bit dated, I'd say. The asker's textbook is at least 5 editions behind. – Kevin Krumwiede Mar 19 '18 at 6:13
2

This is true of oldschool ethernet implementations (10base2, 10base5 et al ... as well as 10baseT and 100baseT IF a non-switching hub was used) that actually used a physically or logically shared medium (cabling plant) to connect more than two transmission capable ports. If two stations accidentally transmitted at the same time, the signal on that shared medium became garbled - network ports were designed to detect such garbled signals and send yet another signal onto the medium, that could still be read correctly over the garbled data and signalled everyone that all their transmissions are invalid and will have to be repeated after a backoff time. The problem with these setups was that if anything loaded the network to its limit with small packets, the achievable bandwidth ended up significantly below the theoretical maximum, since bandwidth got wasted resolving collisions instead of transmitting data.

In a fully-switched Ethernet (as you would get when building it with any parts commonly available in a store after ca. 2004. "Fully switched" because hybrid forms exist(ed) where mutiple shared media (with more than 2 ports) were separated by switches), there are always two ports (one is on the switch, the other on a computer or other connected device) sharing a medium. Any "T" type ethernet has separate wire pairs for each direction, so between two ports it will always be possible for both of them to transmit and receive at the same time. A switch will always order packets from multiple senders into one valid sequence and transmit it wherever it decides it needs to send them, unless it is actually overloaded (which is unlikely to occur in a home network situation).

For completeness, certain other (nowadays rarely used) non-Ethernet wired LAN systems (eg Token Ring, FDDI) used different methods to discipline medium access, in some cases positively negotiating the privilege to send before anyone got to transmit a payload.

WIFI also has to deal with a shared medium problem, and also the fact that two conflicting transmitters might have different visibility to different receivers. An algorithm called CSMA/CA is used to resolve this.

1

On a 10Mb/s network a full-sized packet takes about 1ms to transmit. Most game packets are much smaller, so no you don't notice this latency and could get hundreds of updates per second pretty easily. The big lag comes from distance at least 18ms per 1000 mi. This is the sppeed of light and can't be avoided. Other packets on the wire can add to that latency - that's called jitter.

  • 1
    "Other packets on the wire can add to that latency - that's called jitter." Actually, jitter is a changing latency. I think you mean congestion, which is one of the causes of jitter. Real-time protocols, e.g. VoIP, can often work well with a fairly large latency, but a constantly changing latency (jitter) will cause severe problems. – Ron Maupin Mar 19 '18 at 1:19
  • Never assume bandwidth and latency need to be related. A truck full of hard drives has a huge bandwidth, but a large latency as well. The latency is about when the first bit arrives, the bandwidth is about how fast the next bits come after the first one. – allo Mar 19 '18 at 12:23
0

In every video game there is always lag between the time a player offers input (pushing a button, moving a joystick, etc.) and the reaction to that. There's even a perceptible delay between the computer sensing a control change and that change appearing in the next frame on the screen*, which is why some gamers will reduce graphics settings (making the game less pretty) to maintain 60 FPS.

Networks will introduce this lag, too, for various reasons, one of which is because players can't receive two messages at the same time. If two other computers try to send a message at the same time either one will back off and let the other go first (on a shared transmission medium, such as WiFi) or a switch will receive both at the same time but send one before the other to the destination (modern wired Ethernet).

The delays on a LAN are small, however, and are dwarfed by the amount of delay (tens or even hundreds of times greater) produced by playing over the Internet.

So how can that that work? Typically games will model the other player, predicting future motion based on current motion, so that you see him moving smoothly in a certain direction even if your computer is not always getting immediate updates about where he really is. (The code that does this is often referred to as netcode.) This is why players will sometimes suddenly jump from one place to another; the prediction got out of sync with what really was happening, often due to a network delay.


*This isn't usually perceived as, "I saw a delay" but "the controls feel sluggish" or similar.

  • 1
    Not to mention the lag between "something changes on the screen", "you notice something changes on the screen", "you plan a response action" and "you actually move your hand/finger". All large animals need pretty decent lag compensation circuitry to even have a chance of doing anything in the real world. Latency hiding is a thing in animals as much as it is in game netcode - and neurons transmit much slower than copper cables; the fastest healthy neurons transmit at about 120 m/s. Even with much longer cables, that's far more latency than you get on a typical LAN. – Luaan Mar 19 '18 at 12:17

protected by Ron Maupin Mar 19 '18 at 1:25

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.