Skip to content

Commit

Permalink
fixed figures and diagrams
Browse files Browse the repository at this point in the history
  • Loading branch information
cwoodruff committed Oct 5, 2024
1 parent e234bf4 commit 9e2591e
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 17 deletions.
4 changes: 2 additions & 2 deletions Chapter01/chapter01.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ TCP/IP operates on a layered architecture. This modular approach breaks down the

![](./Images/Chapter01-02.png)

**Figure 1.1 - 1TCP/IP Protocol Layers**
<figcaption align = "center"><b>TCP/IP Protocol Layer</b></figcaption>

This layered architecture enables modular design, where each layer contributes specific functionalities, resulting in the robust and scalable network communication we rely on today. In the diagram illustrated above, showing the layered architecture of the TCP/IP protocol, each layer transitions seamlessly into the next, representing a hierarchy of functions essential for network communication. Starting at the application layer, protocols like HTTP and FTP interact with end-user applications, preparing data for communication. This data is then encapsulated into segments by the transport layer, where TCP or UDP manages the trustworthiness and flow of the data between hosts. Following this, the internet layer takes charge, wrapping the data with IP addresses through the Internet Protocol, ensuring it reaches the correct destination across the network. Finally, the link layer translates these IP packets into frames appropriate for the physical network medium, handling the data transmission over physical hardware such as Ethernet. Each layer serves a precise purpose, and together, they form the framework that allows data to be carried from one device to another across diverse and complex networks.

Expand Down Expand Up @@ -210,7 +210,7 @@ Client-server architecture serves as the blueprint for communication between dev

![](./Images/Chapter01-01.png)

**Figure 1.2 - Client-Server Model**
<figcaption align = "center"><b>Client-Server Model</b></figcaption>

This architecture (seen in _Figure 1.2_) enables efficient distribution of tasks, with servers handling resource-intensive processes and clients focusing on user interfaces and interactions. It forms the backbone of modern networked applications, allowing for scalable, centralized, and secure data processing and access in various domains, from web hosting to database management.

Expand Down
10 changes: 5 additions & 5 deletions Chapter02/chapter02.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ The structure of IPv4 addresses lies at the core of the internet's architecture,

![Chapter02-01](./Images/Chapter02-01.jpg)

**Figure 2.1 -– IPv4 Addressing**
<figcaption align = "center"><b>IPv4 Addressing</b></figcaption>

An IPv4 address is a 32-bit numerical label that is divided into four octets, each containing 8 bits. These octets are separated by periods, giving rise to the familiar decimal-dot notation, such as 192.168.0.1. This arrangement is crucial for both human comprehension and the computational efficiency of network routers and devices.

Expand Down Expand Up @@ -96,7 +96,7 @@ Subnet masks are expressed in the same format as IP addresses, comprising four o

![Chapter02-02](./Images/Chapter02-02.jpg)

**Figure 2.2 – IP Subnet Masking**
<figcaption align = "center"><b>IP Subnet Masking</b></figcaption>

To grasp the concept of subnet masks, consider a simple analogy: an IP address and its subnet mask are like a street address and a zip code. Just as a street address indicates a specific location, an IP address designates a particular device on a network. The subnet mask, analogous to the zip code, guides data packets to their intended destination. For example, let's take the IP address 192.168.1.25 and a subnet mask of 255.255.255.0 (/24). In binary representation, the subnet mask appears as 11111111.11111111.11111111.00000000. This signifies that the first 24 bits of the IP address pertain to the network portion, while the remaining 8 bits are allocated for host identification.

Expand Down Expand Up @@ -201,7 +201,7 @@ Network topologies, like the diverse landscapes of a digital realm, define how d

![Chapter02-03](./Images/Chapter02-03.jpg)

**Figure 2.3 – Common Network Topologies**
<figcaption align = "center"><b>Common Network Topologies</b></figcaption>

Choosing the right topology depends on factors such as network size, communication patterns, fault tolerance needs, and budget constraints. A small office might benefit from a star topology, while a data center might prefer a mesh topology for maximum redundancy.

Expand Down Expand Up @@ -309,7 +309,7 @@ The communication process is the backbone of data exchange in a networked enviro

![Chapter02-04](./Images/Chapter02-04.jpg)

**Figure 2.4 -– How TCP/IP Works**
<figcaption align = "center"><b>How TCP/IP Works</b></figcaption>

Understanding the communication process is crucial for network engineers, software developers, and anyone working with networked systems. It enables the design of efficient and reliable communication systems, the troubleshooting of issues, and the optimization of network performance.

Expand Down Expand Up @@ -377,7 +377,7 @@ In the vast expanse of networked systems, a tapestry of indispensable services w

![](Images/Chapter02-05.jpg)

**Figure 2.5 – Common Protocols and Ports**
<figcaption align = "center"><b>Common Protocols and Ports</b></figcaption>

These are but a few threads in the intricate tapestry of network services that enable our digital lives. Each service weaves its unique functionality into the collective experience, fostering connectivity, collaboration, and communication across the networked landscape.

Expand Down
16 changes: 12 additions & 4 deletions Chapter05/chapter05.md
Original file line number Diff line number Diff line change
Expand Up @@ -562,9 +562,13 @@ In this example, `ThreadSafeLogger` ensures that log entries are written without

For more in-depth testing, tools like **Visual Studio’s Concurrency Visualizer** or **Parallel Stack in JetBrains Rider** can help identify performance bottlenecks and threading issues such as lock contention and deadlocks. Unit testing frameworks like NUnit or xUnit, combined with `Task` and async/await patterns, allow for the simulation and testing of asynchronous and parallel operations in a controlled environment.

![Visual Studio’s Concurrency Visualizer](./Images/ConcurrencyVisualizer.png)
![](./Images/ConcurrencyVisualizer.png)

![JetBrains Rider's Parallel Stack](./Images/ParallelStack.png)
<figcaption align = "center"><b>Visual Studio’s Concurrency Visualizer</b></figcaption>

![](./Images/ParallelStack.png)

<figcaption align = "center"><b>JetBrains Rider's Parallel Stack</b></figcaption>

Unit testing frameworks like NUnit or xUnit can be used to test multithreaded code, but they require careful planning to cover concurrency issues. One approach is to simulate multithreading scenarios where shared resources are accessed concurrently to ensure the code behaves as expected. Here’s a simple example using xUnit and the Task class to test a thread-safe counter class:

Expand Down Expand Up @@ -874,9 +878,13 @@ Optimizing network communication itself is also vital. Techniques such as reduci

Finally, profiling and monitoring tools such as **Visual Studio Diagnostic Tools** or **JetBrains' Monitor Tool Window** can be instrumental in identifying bottlenecks and performance issues. Regularly profiling your network applications can help you understand where delays or excessive resource usage occur, allowing for targeted optimizations that can substantially improve overall performance.

![Visual Studio Diagnostic Tool](./Images/DiagnosticTools.png)\
![](./Images/DiagnosticTools.png)

<figcaption align = "center"><b>Visual Studio Diagnostic Tool</b></figcaption>

![](./Images/MonitoringToolWindow.png)

![JetBrains' Monitor Tool Window](./Images/MonitoringToolWindow.png)\
<figcaption align = "center"><b>JetBrains' Monitor Tool Window</b></figcaption>

By implementing these performance optimization techniques, developers can ensure that their network applications are not only functional but also robust and efficient, capable of efficiently handling real-world loads.

Expand Down
18 changes: 12 additions & 6 deletions Chapter09/chapter09.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ The HEAD method is similar to GET but with a key difference: it only retrieves t
Each of these methods plays a vital role in building web services that are efficient, scalable, and easy to maintain. When designing APIs, your choice of the appropriate HTTP method is crucial. It ensures clarity in communication between client and server, adheres to REST principles, and improves the overall structure and reliability of your application. This responsibility in choosing the right method gives you full control over your API design, ensuring that your application is efficient and reliable.

![](./Images/HTTP Verbs.png)
*HTTP Verbs*

<figcaption align = "center"><b>HTTP Verbs</b></figcaption>

### HTTP Headers

Expand Down Expand Up @@ -86,7 +87,8 @@ Finally, the 5xx series represents server-side errors, which occur when the serv
Using the correct HTTP status codes is not just a best practice, it's a responsibility. It helps establish clear communication between clients and servers. Clients rely on these codes to interpret the result of their requests and take the necessary actions. As we delve deeper into RESTful API design, proper use of status codes will play a critical role in defining the behavior and reliability of the APIs we build. It ensures both developers and consumers of the API can interact with the system smoothly and effectively, reinforcing your commitment to your work.

![](./Images/HTTP Status Codes.png)
*HTTP Status Codes*

<figcaption align = "center"><b>HTTP Status Codes</b></figcaption>

### HTTP Messages and Data Exchange

Expand Down Expand Up @@ -193,22 +195,26 @@ To begin building a RESTful API with ASP.NET Core 8, the first step is setting u
Open Visual Studio 2022 and create a new project by selecting **Create a new project** from the start window. From the project template list, choose **ASP.NET Core Web API** and click **Next**. Provide a name for your project, choose a location to save it, and click **Create**. In the following dialog, ensure that **.NET 8** is selected as the target framework, and check the option to enable **OpenAPI support** for automatic API documentation generation. Click **Create** to initialize the project.

![](./Images/VS22-WebAPI-Creation.png)
*Visual Studio 2022 Project Creation*

<figcaption align = "center"><b>Visual Studio 2022 Project Creation</b></figcaption>

![](./Images/VS22-WebAPI-Additional.png)
*Visual Studio 2022 Web API Project Additional*

<figcaption align = "center"><b>Visual Studio 2022 Web API Project Additional</b></figcaption>

Once the project is generated, Visual Studio creates a default folder structure that includes several key components. The **Controllers** folder contains the default WeatherForecastController file, demonstrating how a basic API controller works. In a RESTful API, controllers handle incoming requests and map them to appropriate actions, such as retrieving, creating, or updating resources. You can expand this folder as needed to include additional controllers for various resources in your API.

![](./Images/VS22-WebAPI-Structure.png)
*Visual Studio 2022 Web API Project Structure*

<figcaption align = "center"><b>Visual Studio 2022 Web API Project Structure</b></figcaption>

ASP.NET Core uses dependency injection by default, and services are registered in the **Program.cs** file. This file is crucial in configuring middleware, routing, and services like database connections or authentication. By default, the Program.cs file already contains the basic configuration for handling API requests and serving JSON responses. To add more functionality, you will modify this file to include additional services, such as support for Entity Framework Core or third-party libraries for logging or security.

At this point, your API project is ready to run. Press **F5** or click **Start** to launch the API in the browser. Visual Studio will open the Swagger UI by default, allowing you to interact with the available API endpoints. The Swagger UI is a convenient way to explore and test your API without needing a separate tool like Postman. It automatically generates API documentation based on the OpenAPI specification and allows you to test requests against the available endpoints.

![](./Images/VS22-WebAPI-Swagger.png)
*Web API Project Swagger*

<figcaption align = "center"><b>Web API Project Swagger</b></figcaption>

To add your first custom API controller:
1. Right-click on the **Controllers** folder and select **Add > Controller**.
Expand Down

0 comments on commit 9e2591e

Please sign in to comment.