Home Topic 3 Last Next


Explain how data is transmitted by packet switching.


Teaching Note:


Sample Question:



JSR Notes:


Through packet switching a file traveling through a network is broken up into pieces and those pieces each find their own best route through the pathways of the network, and the file is re-assembled at the other end.



Multiple Routing Analogies:

Water through different streams during a flood.
As the water rises, more and more different routes the water can take arise, and who knows which way any one drop of water will go.

Tracking a multi-piece order made from Alibaba.com
Even though you ordered all the separate pieces at the same time, they may be sent any variety of routes. If you trace them on-line, one package may come straight on a flight from Beijing to Bangkok, but the others may come via any series of airports and distribution centers between here and Beijing.

A school team that is flying to a tournament has their flight cancelled at the last minute, and they have to reschedule all the members of the team on new flights. The orignal flight was direct from from Los Angeles (L.A.) to New York City (N.Y.). To re-book them as soon as possible, all ways of getting connecting flights from L.A. to N.Y. can be considered, and there are literally thousands of permutations.
- Some team members could go on the remaining seats of the only other available direct flight L.A. to N.Y. which has free seats.
- Others will have to fly L.A. to Chicago, and then on to N.Y.
- And still others will have to go L.A. to Phoenix, then Phoenix to Dallas, and then Dallas to N.Y.
But all will ultimately meet up, all be-it at different times, and a little late, in New York City.

Taking a group of ISB students from school to Terminal 21 in 6 different taxis. Each taxi could potentially take a slightly, or even significantly different route.

Mac Network Utility Traceroute

Even before going any further, try running a traceroute of any website in Network Utility to see number of nodes a packet goes through. (This may not work behind the school firewall, so take a look at some images on the Internet: "traceroute on a Mac".)


*** The structure and a lot of the content for this section come from the former IB CS curriculum "yellow and red" textbook "Computer Science Java Enabled, 2nd Edition, Andrew Meyenn, Richard Jones, pages 343 - 345.


Packet Switching

Definition of Data Packet

Recall that a data packet was defined already in 3.1.6. Groups of data transmitted across a network are referred to as packets. A data packet is typically fixed in length, and its structures is determined by the protocol being used. But the contents of the packet typically include:
- the data payload itself,
- the source address,
- destination address,
- information for error checking (a parity bit or a check digit),
- "TTL" Time to Live - a counter that decrememts each node that is visited (when it reaches 0 the packet is assumed to be lost and so trashed.)
- the packet number, to be used for reassembling the file in the correct order.

(There is a good image on 343 of the Red & Yellow IB textbook which I don't have right now, so I'll put this here for now, from How Stuff Works.)




Definition of Packet Switching

Packet switching is a network transmission technique in which data is sent in individual fixed length groups called data packets. So a single file is broken up into individual packets, and each of those packets is transmitted separately. The key feature is that the individual pockets don't have to follow the same route, but can be sent over the best available link. Each packet is numbered, so when all packets reach their destination, they are reassembled in the correct order.

Each packet also has a counter, which decrements as it passes through each node along the pathway. If the counter reaches zero, that packet is assumed to be lost, and the node discards that packed. Re-transmission of that particular packet will soon be requested.

The main advantage of packet switching is that if a particular link is broken or unavailable during transmission, another link can be used, and the transmission can continue. Packet switching is suitable when small delays can be tolerated, for example, e-mail transmission as compared to streaming content, like a video for example, where is important that there is no delay to your sound or pictures.

A Technical Full Definition (not necessary to know, but for what it's worth):

Packet switching is a digital networking communications method that groups all transmitted data – regardless of content, type, or structure – into suitably-sized blocks, called packets. Packet switching features delivery of variable-bit-rate data streams (sequences of packets) over a shared network. When traversing network adapters, switches, routers and other network nodes, packets are buffered and queued, resulting in variable delay and throughput depending on the traffic load in the network.

Packet Switching vs. Circuit Switching

Packet switching is in contrast to circuit switching, in which there is a fixed link to send the data transmission. That fixed line will be a dedicated connection which can permit transmission at a constant bit rate, with constant delays between nodes. So circuit switching is better for all streaming situation. But because it's dedicated, it costs a lot more, potentially costing per unit time, even when it's not in use. And the other disadvantage of circuit switching, compared to packet switching, is it is subject to failure if the link is broken during transmission.


Role of Nodes in Traffic Management

Connecting the wired and wireless links of a network are nodes. At each nodes is a router, which manages the data traffic. The router inspects each packet and routes it on to what it deems to be the best link, as it continues its journey. There are two factors to be considered by the routing algorithms: determining the shortest path, and determining free notes.

But network traffic management by routers involves not only ensuring that packets are passed on to an appropriate link, they must also manage the big picture, and assure that overall congestion of the network is avoided.


The Packet Switching Protocol TCP/IP

Packet switching protocols establish the rules for node to node communication and application to application interactions across a network. The Internet has established TCP/IP is the default standard protocol for packet switching. TCP/IP is a combination of two separate protocols, TCP, and IP.

Transmission Control Protocol, TCP, is a transport level protocol, in which transportation of data across links is controlled, ensuring that data arrives and is assembled into the correct order. It is a transport level protocol of the OSI model.

The Internet Protocol IP part of TCP/IP divides data into packets and identifies the packets so that their destination (i.e. source address) can be determined. It is a network layer OSI protocol.

IP Addresses

Part of IP is the addressing of devices with "IP addresses". Typical computer users don't interact with these address; rather we use their associated World Wide Web addresses, which we type into browsers. So, for example, www.johnrayworth.info actually has the IP address DNS (Domain Name Servers) look after the linking of IP addresses to domain names behind the scenes.

The IP protocol uses either four (IPv4) or sixteen (IPv6) sets of eight bytes for the address.

An IP address is binary numbers but usually we see IPv4 represented in decimal, or IPv6 represented in hexadecimal, which are both easier for human readers.

: 32-bit addresses, so     2 ^ 32,   or    4 billion    possible IP addresses
or, 4 000 000 000 different devices that are uniquely addressable

Example IPv4 addresses in decimal:

: 128-bit addresses, so     2 ^ 128,   or   4 billion x 4 billion x 4 billion x 4 billion    different IP address
or, 256 000 000 000 000 000 000 000 000 000 000 000 000 different devices that are uniquely addressable

Example IPv6 addresses in hexadecimal:


Packet Errors

A crucial part of any networking protocol is how is deals with potential errors.

One possible source of error is collisions, in which the same link is attempted to be used by two packets at the same time. In such a case, the router will communicate with the sender of the packets and they will be resent.

But data integrity errors can also occur, particularly as a result of interference, either from other wires, or various other electromagnetic sources. So upon arrival at its destination, a data packet is checked to see if there had been any error in transmission - there are checks to see if what was intended to be sent is what was received; this is done, for example via check bits, or parity checking. (There is more on these error checking algorithms back in 3.1.7). If an error is found, the destination router will request a resend.

Obviously the higher the error rate the slower the performance of the transmission.




- In packet switching a file is broken up into packets and each packet is transmitted separately.

- Data packet are fixed in length, and their structure is determined by the protocol used.

- Each packet includes a packet number for reordering at the destination.

- Packet errors can occur as result of collisions or interference; retransmission is requested in these cases.

- Each packet has a counter which decrements as it passes through a node, and if it gets lost, then after a certain number of hops, the packet is trashed.

- Packet switching is suitable when small delays can be tolerated (i.e. email transmission), or the complete transmission doesn't have to happen all together.

- Streaming an example of circuit switching, which is the other way that data can be transmitted, in contrast to packet switching.


And back to the assessment statement:

Ultimately you should be prepared to explain, in summary, this concept in a 5-6 mark kind of an answer. But you should also be prepared to address certain parts of it - in the same way that some of my homework questions will pin-point important concepts.






JSR Notes - FORMER CURRICULUM - 6.4.3 Describe packet switching.:

Once again, lots of good stuff in the text, but I’ll focus you a bit here.

First the analogy. You're in O2 stadium after a concert, with 99 of your friends (...yes, 99. Think Facebook.) There are two ways you can try to make it to the meeting point outside. Option 1: All hold hands, and go together (imagining that many other large groups are doing the same thing...) "Nope, no letting go of hands. Just wait for that group to pass..." etc.
Option 2: Everyone just go as quickly as they can, whatever route they choose, squeezing in and out of people along the way, and re-assemble back at the meeting point. (And the sad part of this analogy: "Anyone who doesn't make it there in 5 minutes, we're leaving without you!")

(Actually, analogies of traffic from one part of town to another is more accurate, or even the way a "peloton" of cyclists in a race splits up some times. But the analogy above is a bit more fun.)

Certainly you should be aware of the various things that need to be in each packet and why. But the big thing here is what the teaching note focuses in on: the “switching” in packet switching. Yes, in packet switching the data is grouped into small packets which are sent. But the reason that they are divided up into smaller groups in the first place is that those packets can then switch the route that they are taking depending on traffic in given routes. In fact, theoretically, even with a very large file being downloaded to your computer the packet switching way could have each and every packet following a different route.

And in terms of the possible routes a packet can take, it’s almost infinite. The analogy of flying from New York to LA is a good one; there is not just one direct way to do that trip; you can literally come up with tens of thousands of different routes through major airports and minor along the way, but always be going in a Westerly direction. Doing a “traceroute” in the Network utility of the Mac OS is an interesting visual way to see just how many “hops” there can be from node to node as a packet finds its way (or not) to its destination.

And that’s the other teaching note not to forget: Packets can indeed get “lost”; that’s why the “time to live” information is decremented as it makes its way around.