万本电子书0元读

万本电子书0元读

顶部广告

Hands-On Network Programming with C# and .NET Core电子书

售       价:¥

4人正在读 | 0人评论 6.2

作       者:Sean Burns

出  版  社:Packt Publishing

出版时间:2019-03-29

字       数:77.4万

所属分类: 进口书 > 外文原版书 > 电脑/网络

温馨提示:数字商品不支持退换货,不提供源文件,不支持导出打印

为你推荐

  • 读书简介
  • 目录
  • 累计评论(0条)
  • 读书简介
  • 目录
  • 累计评论(0条)
A comprehensive guide to understanding network architecture, communication protocols, and network analysis to build secure applications compatible with the latest versions of C# 8 and .NET Core 3.0 Key Features * Explore various network architectures that make distributed programming possible * Learn how to make reliable software by writing secure interactions between clients and servers * Use .NET Core for network device automation, DevOps, and software-defined networking Book Description The C# language and the .NET Core application framework provide the tools and patterns required to make the discipline of network programming as intuitive and enjoyable as any other aspect of C# programming. With the help of this book, you will discover how the C# language and the .NET Core framework make this possible. The book begins by introducing the core concepts of network programming, and what distinguishes this field of programming from other disciplines. After this, you will gain insights into concepts such as transport protocols, sockets and ports, and remote data streams, which will provide you with a holistic understanding of how network software fits into larger distributed systems. The book will also explore the intricacies of how network software is implemented in a more explicit context, by covering sockets, connection strategies such as Transmission Control Protocol (TCP) and User Datagram Protocol (UDP), asynchronous processing, and threads. You will then be able to work through code examples for TCP servers, web APIs served over HTTP, and a Secure Shell (SSH) client. By the end of this book, you will have a good understanding of the Open Systems Interconnection (OSI) network stack, the various communication protocols for that stack, and the skills that are essential to implement those protocols using the C# programming language and the .NET Core framework. What you will learn * Understand the breadth of C#'s network programming utility classes * Utilize network-layer architecture and organizational strategies * Implement various communication and transport protocols within C# * Discover hands-on examples of distributed application development * Gain hands-on experience with asynchronous socket programming and streams * Learn how C# and the .NET Core runtime interact with a hosting network * Understand a full suite of network programming tools and features Who this book is for If you're a .NET developer or a system administrator with .NET experience and are looking to get started with network programming, then this book is for you. Basic knowledge of C# and .NET is assumed, in addition to a basic understanding of common web protocols and some high-level distributed system designs.
目录展开

About Packt

Why subscribe?

Packt.com

Contributors

About the author

About the reviewer

Packt is searching for authors like you

Dedication

Preface

Who this book is for

What this book covers

To get the most out of this book

Download the example code files

Conventions used

Get in touch

Reviews

Section 1: Foundations of Network Architecture

Networks in a Nutshell

Technical requirements

Expanding the scope of software – distributed systems and the challenges they introduce

What is a network?

An arbitrarily large set

Computational devices

Navigational devices

Channels of communication

The software impact

The impact of device-agnosticism

Writing for open communication

Topologies and physical infrastructure

Physical and logical topologies

Point-to-point topology

Linear topology (daisy-chaining)

Bus topology

Star topology

Ring topology

Mesh topology

Fully connected mesh network

Hybrid and specialized topologies

The software impact of distributing resources on a network

Security

Communication overhead

Resilience

Asynchrony

Network objects and data structures in .NET Core

Using System.Net

Getting specific with sub-namespaces

A whole new computing world

Long – distance communication

Share functionality, not code

Summary

Questions

Further reading

DNS and Resource Location

Technical requirements

Needles in a haystack – data on the internet

The first network addresses

DNS – the modern phone book

URLs, domain names, and device addresses

URLs – user-friendly addressing

URL components

The authority component

The path component

The query component

The fragment component

Putting it all together

Authority specification

Query specification

The URL as a sub-type of the URI

The System.Net.UriBuilder class

Hosts – domain names and IPs

The DNS in C#

Summary

Questions

Further reading

Communication Protocols

Technical requirements

The Open Systems Interconnection network stack

What exactly is the Open Systems Interconnection?

The origins of the OSI

The Basic Reference Model

The layers of the network stack

The Host/Media distinction

The application layer

The presentation layer

The session layer

Full-duplex, half-duplex, and simplex communication

The transport layer

The network layer

The data-link layer

The physical layer

Putting it all together

The application layer

The most common layer in the stack

HTTP – application to application communication

What is HTTP?

The client - server model in HTTP

Request/response

HTTP sessions

Request methods

Status codes

The HTTP message format

HTTP in C#

FTP and SMTP – the rest of the application layer

FTP and SFTP

SMTP

The Transport layer

TCP

UDP

Connection versus connectionless communication

Summary

Questions

Further reading

Packets and Streams

Technical requirements

Leveraging networks – transmitting packets for use by remote resources

Bandwidth

Latency

Mechanical latency

Operating system latency

Operational latency

Signal strength

The anatomy of a packet

What is a packet?

Setting up Wireshark

Atomic data

Encapsulated with sufficient context

Error detection and correction

Streams and serialization – understanding sequential data transmission

The Stream class

Summary

Questions

Further reading

Section 2: Communicating Over Networks

Generating Network Requests in C#

Technical requirements

One class to rule them all – the WebRequest abstract class

The interface or abstract class

The interface

The constructors

Class properties

The class methods

State management methods

Request execution methods

The sub-classes of the WebRequest class

A note on obsolete sub-classes

HttpWebRequest

FtpWebRequest

FileWebRequest

Summary

Questions

Further reading

Streams, Threads, and Asynchronous Data

Technical requirements

Going with the flow – data streams in C#

Initializing a data stream

Writing to and reading from a data stream

The seek operation

Reading from streams

The right stream for the job

Stream readers and writers

Newtonsoft.Json

The StreamReader and StreamWriter classes

Seek versus Peek

The NetworkStream class

Picking up the pace – multithreading data processing

Asynchronous programming for asynchronous data sources

A final note on blocking code

Summary

Questions

Further reading

Error Handling over the Wire

Technical requirements

Multiple devices, multiple points of failure

External dependencies

Parsing the exception status for context

Status codes and error messages

Status messages and status codes

Useful error messages

Error-handling strategies

Resilient requests with Polly

Summary

Questions

Further reading

Section 3: Application Protocols and Connection Handling

Sockets and Ports

Technical requirements

Sockets versus ports

Ports – a hardware interface

Reserved ports

Exposing multiple applications on a single port

Sockets – a software interface to a port

Leveraging sockets in C#

The socket specification

Establishing a socket connection

Parsing responses

Summary

Questions

Further reading

HTTP in .NET

Technical requirements

Cracking open HTTP

The nature of HTTP

The application layer and the transport layer

The history of HTTP

Web services and HTTP

The advent of SOAP

The rise of REST

HTTP web services in .NET core

From MVC to web API

The many methods of HTTP

Creating a web API project

The web server

IWebHostBuilder

Using launchSettings.json

Registering dependencies in startup.cs

The IHttpClientFactory class

Registering services in Startup.cs

Handling incoming HTTP methods

The GET method

The POST method

The PUT and PATCH methods

The DELETE method

HTTP request formatting

Creating HttpClient instances

Building a request message

Posting request content

HTTPS – security over HTTP

Establishing outbound HTTPS connections

Supporting HTTPS on your server

HTTP/2

New features of HTTP/2

HTTP/2 in .NET core

Summary

Questions

Further reading

FTP and SMTP

Technical requirements

File transfer over the web

The intent of FTP

Active and passive connections

Transfer modes and data representations

Exposing directories for FTP

Configuring your FTP server

Writing an FTP client

Fetching a directory listing

Transferring a file

Uploading a file via FTP

Securing FTP requests

The risks of FTP

Securing FTP with SFTP and FTPS

SFTP

FTPS

SMTP and MIME

The email protocol

Extending SMTP with MIME

SMTP in .NET Core

Summary

Questions

Further reading

The Transport Layer - TCP and UDP

Technical requirements

The transport layer

The objectives of the transport layer

Establishing a connection

Ensuring reliability

Error correction

Managing traffic

Segmentation of data

The classes of transport layer protocols

Class 0 – Simple class

Class 1 – Basic recovery class

Class 2 – Multiplexing class

Class 3 – Error recovery and the multiplexing class

Class 4 – Detecting errors and recovery class

Connection-based and connectionless communication

Connection-based communication

Connections to establish sessions

Circuit-switched versus packet-switched connections

TCP as a connection-oriented protocol

Connectionless communication

Stateless protocols

Broadcasting over connectionless communication

Establishing connections over connectionless communication

UDP as a connectionless communication protocol

Detecting errors in connectionless protocols

TCP in C#

Initializing a TCP server

Initializing a TCP client

Connection information without data transfer

Transmitting data on an active connection

Accepting an incoming TCP request on the server

The request/response model on the server

Finalizing the TCP client

UDP in C#

Initializing a UDP client

The send/receive paradigm

Multicasting packets

Multicasting in .NET

Summary

Questions

Further reading

Section 4: Security, Stability, and Scalability

The Internet Protocol

Technical requirements

The IP standard

The origins of IP

IPv0 – a network layer protocol for TCP

IPv1 to IPv3 – formalizing a header format

IPv4 – establishing the IP

The functions of IP

Addressing for IP

The fragmentation of packets

IPv4 and its limits

The addressing standard of IPv4

The IPv4 address syntax

Classful IP addressing

Subnet masking

Address space exhaustion

IPv6 – the future of the protocol

The IPv6 addressing scheme

Network fields and routing efficiency

Fragmentation in IPv6

IPv6 to IPv4 interfaces

Side-by-side IP deployment

Tunneling interfaces

Leveraging IP in C#

Setting up our server

IP parsing in C#

Using the IPAddress class in C#

Summary

Questions

Further reading

Transport Layer Security

Technical requirements

Private connections and SSL

Establishing secure connections

Trusted certificate authorities

The basis of trust in certificate authorities

Simple and mutual authentication

Encrypting transmitted data

Asymmetric and symmetric cryptography

Negotiating cryptographic keys

The SSL protocol

TLS as the new standard

A minor evolution from SSL

Forward secrecy

Reliability of secured messages

Configuring TLS in .NET Core

Enabling HTTPS in .NET Core

Enforcing HTTPS with HSTS

HTTPS port configuration

Trusting your development certificate

The TLS handshake simulation

Identity verification

Negotiating the encryption scheme

Summary

Questions

Further reading

Authentication and Authorization on Networks

Technical requirements

The authorization header

Authorization versus authentication

Authentication

Authorization

Authorization header values

Basic authentication

The user information URL segment

Basic authentication with header values

Encryption versus encoding

Bearer token authorization

OAuth basics

Authorizing with bearer tokens

Digest authentication

The Digest authentication WWW-Authenticate header

Digest authentication's authorization header

HTTP origin-bound access

Authorization tokens

OAuth token provisioning

Token generation

Persisted tokens

Self-encoded tokens

Authorization in .NET Core

The AuthorizeAttribute

Authorization middleware

Generating a token

Applying user claims

Summary

Questions

Further reading

Caching Strategies for Distributed Systems

Technical requirements

Why cache at all?

An ideal caching scenario

The principles of a data cache

Caching long-running queries

Caching high-latency network requests

Caching to preserve state

When to write to a cache

Pre-caching data

On-demand cache writing

Cache replacement strategies

Cache invalidation

Distributed caching systems

A cache-friendly architecture

The case for a distributed cache

The benefits of a distributed cache

Working with caches in code

Writing our backing data system

Leveraging a cache

The distributed cache client in .NET

Getting and setting cache records

Cache providers

The SqlServerCache provider

The MemoryCache provider

Summary

Questions

Further reading

Performance Analysis and Monitoring

Technical requirements

Network performance analysis

End-to-end performance impacts

Compounding latency

A three-tiered architecture

Performance under stress

Performance monitoring

Naive monitoring strategies

Overuse of logging

Delayed alerting

Establishing proactive monitoring

Defining thresholds

Proactive health checks

Active messaging and active recovery

Performance and health monitoring in C#

An unstable distributed architecture

Performance-monitoring middleware

Implementing a watchdog

Summary

Questions

Further reading

Section 5: Advanced Subjects

Pluggable Protocols in .NET Core

Technical requirements

Understanding pluggable protocols

What exactly is a pluggable protocol?

Why use pluggable protocols?

Defining a pluggable protocol

Defining your schema

Implementing your protocol interactions

Registering your schema

Building our custom subclasses

Defining our protocol

Implementing our protocol

Implementing the request pipeline

Deriving from the WebResponse class

Leveraging a custom protocol

Implementing the IWebRequestCreate interface

Going beyond WebRequest

Summary

Questions

Further reading

Network Analysis and Packet Inspection

Technical requirements

Network resources and topography

Node-to-node communication

Broadcast addressing

Network analysis

Understanding the NetworkInformation namespace

Querying physical device information

Querying connection information

Monitoring traffic and remote device information

Additional tools and analysis

Using Wireshark for packet inspection

Summary

Questions

Further reading

Remote Logins and SSH

Technical requirements

What is SSH?

The origin of SSH

The SSH protocol design

The transport tier

The user authentication tier

The public key authentication mode

The password authentication mode

The host-based authentication mode

The connection tier

The versatility of SSH

Use with FTP

Use as a network tunnel

Establishing SSH connections

Setting up a remote host

Connecting to an SSH server with SSH.NET

Remote execution with SSH

Creating commands in SSH.NET

Modifying our remote host

Summary

Questions

Further reading

Other Books You May Enjoy

Leave a review - let other readers know what you think

累计评论(0条) 0个书友正在讨论这本书 发表评论

发表评论

发表评论,分享你的想法吧!

买过这本书的人还买过

读了这本书的人还在读

回顶部