Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Hands-On Network Programming with C# and .NET Core

You're reading from   Hands-On Network Programming with C# and .NET Core Build robust network applications with C# and .NET Core

Arrow left icon
Product type Paperback
Published in Mar 2019
Publisher
ISBN-13 9781789340761
Length 488 pages
Edition 1st Edition
Languages
Tools
Concepts
Arrow right icon
Author (1):
Arrow left icon
Sean Burns Sean Burns
Author Profile Icon Sean Burns
Sean Burns
Arrow right icon
View More author details
Toc

Table of Contents (26) Chapters Close

Preface 1. Section 1: Foundations of Network Architecture FREE CHAPTER
2. Networks in a Nutshell 3. DNS and Resource Location 4. Communication Protocols 5. Packets and Streams 6. Section 2: Communicating Over Networks
7. Generating Network Requests in C# 8. Streams, Threads, and Asynchronous Data 9. Error Handling over the Wire 10. Section 3: Application Protocols and Connection Handling
11. Sockets and Ports 12. HTTP in .NET 13. FTP and SMTP 14. The Transport Layer - TCP and UDP 15. Section 4: Security, Stability, and Scalability
16. The Internet Protocol 17. Transport Layer Security 18. Authentication and Authorization on Networks 19. Caching Strategies for Distributed Systems 20. Performance Analysis and Monitoring 21. Section 5: Advanced Subjects
22. Pluggable Protocols in .NET Core 23. Network Analysis and Packet Inspection 24. Remote Logins and SSH 25. Other Books You May Enjoy

The DNS in C#

It is occasionally necessary to identify the underlying IP address for a domain name from within the context of our software. For that, .NET Core provides the static Dns class as part of the System.Net namespace. With the Dns class, we can access directory information as returned by the nearest downstream name server capable of resolving the given name. We can request an instance of the IPHostEntry class, containing all of the relevant directory information of a DNS entry, or simply an array of IP addresses registered to resolve requests against the domain name.

To see this in action, simply invoke any of the methods exposed by the static Dns class in a sample program as follows:

using System;
using System.Net;
using System.Threading;

namespace DnsTest {
public class DnsTestProgram {
static void Main(string[] args) {
var domainEntry = Dns.GetHostEntry...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime