16. Networking || C# 10 Flashcards

1
Q

List standard network protocol key components and describe what are they meant for

A
  1. HttpClient - for consuming HTTP web APIs and RESTful services;
  2. HttpListener - for writing an HTTP server;
  3. SmtpClient - for constructing and sending mail messages via SMTP;
  4. Dns - for converting between domain names and addresses;
  5. TcpClient, UdpClient, TcpListener and Socket classes - for direct access to the transport and network layers;
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Can you name the purpose of application layer?

A

The application layer defines higher-level protocols designed for specific applications such as retrieving web pages (HTTP), sending mail (SMTP), and converting between domain names and IP addresses (DNS).

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

Can you name the purpose of transport layer?

A

The transport layer defines basic protocols for sending and receiving bytes (TCP and UDP);

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

What is a HTTP protocol?

A

HTTP (Hypertext Transfer Protocol) is a protocol used for transferring data over the internet. It’s the foundation of data communication on the World Wide Web. HTTP enables the exchange of information between a client (typically a web browser) and a server, allowing users to request and receive web pages, files, and other resources from websites. It operates as a request-response protocol, where a client sends requests for specific resources, and the server responds with the requested data, typically in the form of HTML pages, images, or other media. HTTP is a text-based protocol and operates over TCP/IP, making it a fundamental part of web communication.

HTTP (HyperText Transfer Protocol) - Retrieves web pages and runs web services;

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

Describe what do these acronyms mean:

  1. DNS
  2. FTP
  3. HTTP
  4. IIS
  5. IP
  6. LAN
  7. POP
  8. REST
  9. SMTP
  10. TCP
  11. UDP
  12. UNC
  13. URI/URL
A
  1. DNS (Domain Name Server) - Converts between domain names (ebay.com) and IP addresses (199.54.213.2);
  2. FTP (File Transfer Protocol) - Internet-based protocol for sending and receiving files;
  3. HTTP (HyperText Transfer Protocol) - Retrieves web pages and runs web services;
  4. IIS (Internet Information Services) - Microsoft’s web server software;
  5. IP (Internet Protocol) - Network-layer protocol below TCP and UDP;
  6. LAN (Local Area Network) - Most LANs use Internet-based protocols such as TCP/IP
  7. POP (Post Office Protocol) - Retrieves Internet mail;
  8. REST (REpresentational State Transfer) - A popular web service architecture that uses machine-followable links in responses and that can operate over basic HTTP;
  9. SMTP (Simple Mail Transfer Protocol) - Sends internet mail;
  10. TCP (Transmission and Control Protocol) - Transport-layer internet protocol on top of which most high-leyer services are built;
  11. UDP (Universal Datagram Protocol) - Transport-layer internet protocol used for low-overhead services such as VoIP; The TCP and UDP protocols break out each IP address into 65,535 ports, allowing a computer on a single address to run multiple applications;
  12. UNC (Universal Naming Convention) - \computer\sharename\filename;
  13. URI/URL (Uniform Resource Identifier/Locator) - Ubiquitous resource naming system (http://www.amazon.com or maito:joe@bloggs.org)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

How many adressing systems do you know? what are they?

A

The internet uses two adressing systems:
1. IPv4 - currently the dominant addressing system; IPv4 addresses are written as four dot-separated decimals (101.102.103.104);
2. IPv6 - The newer addressing system.Addresses are string-formatted in hexadecimal with a colon separator ([3EA0:FFFF:198A:E4A3:4FF2:54fA:41BC:8D31])

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

Do you know how a URI can be broken up?

A

A URI can be broken up into a series of elements - typically, scheme, authority, and path.

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

What is HttpClient?

A

The HttpClient class exposes a modern API for HTTP client operations, replacing the old WebClient and WebRequest/WebResponse types.
HttpClient provides a good experience when dealing with protocols more elaborate than simply fetching a web page. In particular:

  • A single HttpClient instance can handle concurrent requests and plays well with features such as custom headers, cookies, and authentication schemes;
  • HttpClient lets you write and plug in custom message handlers. This enables mocking in unit tests and the creation of custom pipelines;
  • HttpClient has rich and extensible type system for headers and content;

Works like this:
string html = await new HttpClient().GetStringAsync(“http://linqpad.net”);

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

What is a proxy server?

A

A proxy sever is an intermediary through which HTTP requests can be routed. Organizations sometimes set up a proxy server as the only means by which employees can access the internet - primarily because it simplifies security. A proxy has an address of its own and can demand authentication so that only selected users on the LAN can access the internet.

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

What is a HTTP header?

A

A header is simply a key/value pair containing metadata, such as the message content type or server software

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

What is a cookie?

A

A cookie is a name/value string pair that an HTTP server sends to a client in a response header. A web browser client typically remembers cookies and replays them to the server in each subsequent request (to the same address) until their expiry. A cookie allows a server to know whether it’s talking to the same client it was a minute ago - or yesterday - without needing a query string in the URI.

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

What does the HttpListener do?

A

HttpListener waits for the next client request when you call GetContext, returning an object with request and Response properties. Each is analogous to client request or response, but from the server’s perspective. You can read and write headers and cookies, for instance, to the request and response objects, much as you would at the client end.

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

Why one choses BinaryReader and BinaryWriter over StreamReader and StreamWriter?

A

BinaryReader and BinaryWriter might seem like an odd choice for reading and writing strings. However, they have major advantage over StreamReader and StreamWriter: they prefix strings with an integer indicating the length, so a BinaryReader always knows exactly how many bytes to read.

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