levo

Fundamentals of Communication and Networking

Client server model

  • 3 things to know
  • Paper 2

Overview

Recall questions on request-response, why Websockets are used and what full-duplex buys you, CRUD, REST, and JSON against XML.

What you need to know

Answer each one before you reveal it.

Your recallNot started
Process

Why is the Websocket protocol used?

Process

Describe the parts involved when a web page updates its contents from a database without reloading.

Key term

Why does the compactness of JSON matter in a web application specifically?

Questions from this subtopic

Each one with the model answer underneath.

  1. 1

    Describe the client server model.

    Model answer

    In the client server model one program, the client, sends a request message to another program, the server, asking for a service or a resource. The server, which runs continuously waiting for such requests, carries out the work and responds by replying with a response message to the client. The client opens every exchange, and in the plain request-and-response form the server speaks only when it is spoken to. Once a client has opened a Websocket connection, however, that restriction is lifted and the server may send data unprompted.

  2. 2

    Give an everyday example of the request-response exchange.

    Model answer

    A browser sends a request to a web server naming the page it wants; the web server finds or generates that page and sends back a response containing a status code and the page itself. The browser then sends further requests for each image and stylesheet the page refers to, and each is answered with its own response.

  3. 3

    What is the Websocket protocol?

    Model answer

    It is a protocol, with an accompanying programming interface, that turns an ordinary web connection into a lasting full-duplex channel carried over TCP: once established it stays open, and either end — browser or server — may transmit at any moment, both at once if need be. That is the point of it. With plain request-and-response the browser must keep asking whether anything has changed, whereas here the server can push out a new share price, chat message or opponent's move the instant it arises, with no polling and no fresh connection to establish each time.

  4. 4

    Why is the Websocket protocol used?

    Model answer

    Because the ordinary request-response model cannot handle data that arrives at the server unpredictably. Under request-response the server can only speak when spoken to, so to learn about new data the client must keep asking, over and over — polling — which either wastes an enormous number of requests on 'nothing new' or introduces delay while the client waits until its next poll. A Websocket keeps one connection open, so the server can push data to the client the instant it exists. Because the connection is persistent, the cost of setting it up is paid once rather than on every message, and because it is full-duplex, both sides can transmit simultaneously. The result is much lower latency and much less overhead for anything that updates continuously.

  5. 5

    Where would you use a Websocket connection?

    Model answer

    In anything where the server must inform the client of events as they happen: live chat and messaging, notifications, live sports scores or news feeds, collaborative editing where several people work on one document at once, live financial price feeds, multiplayer games, and dashboards showing changing data.

  6. 6

    What does 'full-duplex' mean, and why does it matter here?

    Model answer

    Full-duplex means both parties can transmit at the same time in both directions, rather than taking it in turns. It matters because it removes the strict alternation of request and response: the client can send an input while the server is simultaneously sending an update, which is exactly what real-time interaction requires.

Other ways to work this

The same content, four other ways.

What is inside Levo

Six ways to work the same material.

1Closed book
2Open book
3Closed book

The 3-step method, run for you

Answer cold, learn it, then prove it stuck. Levo tracks the jump between your first attempt and your last.

Fundamentals of Programming
Fundamentals of Data Structures
Fundamentals of Algorithms
Theory of Computation

Cram a whole paper in one sitting

Sort every topic into what you know and what you do not, then drill only the weak ones.

A driver is .
softwarehardwarestorage

Blank Blitz makes facts automatic

Rapid timed gap-fills on the terms and numbers you need to recall without thinking.

AThe integer 5 is 0101.
B0.75 is 1/2 + 1/4.
CThe fraction bits are 1100.

Build It gets the exam shape right

Assemble a full-mark answer from its marking points, in the order an examiner wants them.

Head means the first single element of a non-empty list.
TrueFalse

Test It catches misconceptions

Spot the fault in a statement. The traps are the mistakes students actually make.

721941163128510

Brain Breaks between sessions

Short focus games to reset attention, so the next set lands better than the last.

Every question in Fundamentals of Communication and Networking, on a schedule.

Attempt a question from memory, write the correct version, then attempt it again. Levo records the jump between your first attempt and your last, and brings each question back on the day you are due to forget it.

Or £46 a year, about £3.83 a month. Cancel anytime.