[Fundamental] Networking Flashcards

1
Q

What does TCP stand for and how does it open a connection

A

Transmission control protocol, it’s a connection-based protocol

It guarantees packet receival and order by establishing a three-way handshake

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Explain the TCP 3-way handshake

A

Consists of SYN, SYN-ACK, ACK. Sent with seq. number.

1 2 to establish client to server
2 3 to establish server to client

Syn is asking to open a connection

Ack is an acknowledgement, agreeing to open a connection

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

UDP

A

User Datagram Protocol

  • lightweight
  • no ordering
  • no handshake
  • deliverance is not guaranteed
  • used in multiplayer games, media, DNS lookup
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

HTTP Method

A
  • GET: reads a resource
  • POST: creates a resource or triggers a process
  • PUT: Creates or replace a resource (updates as a whole)
  • PATCH: Partially updates
  • DELETE: Deletes a resource
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Why is HTTP stateless

A
  • each request is executed independently
  • there is no link between two requests being successively carried out on the same connection

HTTP sessions allow users to save states between pages

  • HTTP cookies
  • server-side sessions
  • JWT Token
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Persistent HTTP connection

A

HTTP keep-alive s the idea of using a single TCP connection to send and receive multiple HTTP requests/responses, as opposed to opening a new connection for every single request/response pair

HTTP/2 protocol uses the same idea and takes it further to allow multiple concurrent requests/responses to be multiplexed over a single connection

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

JWT Token

A

Replace saving tokens in DB, a JWT consists of 3 parts:

  • the encoded algorithm
  • the encoded payload
  • hashed header+payload+secret, to verify signature

the server just needs to verify if JWT Token is valid, if. yes user can access a resource

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

cookies vs local storage

A

Everything in cookies are sent for every request

In local storage you can pick which info you wanted to send

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Explain HTTPS request

A

Extension of http, for secure comms over the internet

Flow:
- client: give me sample.com
- server: here’s my certificate and public key
- client: I trust this CA, I’ll verify
- client: I’ll create secret key and encrypt with your public key and share it to you
- all message are encrypted with secret now

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Explain HTTPS certification creation

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Why DNS uses UDP, explain DNS lookup

A

UDP is faster, requests are small, and fit well within udp segments

How well did you know this?
1
Not at all
2
3
4
5
Perfectly