Discover the .NET Framework APIs
Provides classes that allow you to send or receive data from Internet resources.
Sends HTTP requests to a resource identified by a URI.
Provides a simple, cross-platform HTTP protocol listener.
Provides common methods for sending data to and receiving data from a resource.
Represents an Internet Protocol (IP) address.
Provides domain name system (DNS) helper functions.
Provides the Windows Sockets API for network communication.
The HttpClient
class provides a base class for sending HTTP
requests. It is recommended for most client-side scenarios, offering better performance and resource management than older classes like WebClient
.
GetAsync(string requestUri)
Sends a GET
request to the specified Uri
.
Task<HttpResponseMessage>
representing the asynchronous operation.PostAsync(string requestUri, HttpContent content)
Sends a POST
request to the specified Uri
.
requestUri
Uri
to send the request to.content
HttpContent
object that contains the HTTP request body.Task<HttpResponseMessage>
representing the asynchronous operation.See full documentation for HttpClient...
Use the HttpListener
class to create a listener that listens for incoming HTTP
requests. This is useful for building simple web servers or APIs.
Start()
Starts listening for incoming HTTP requests.
Stop()
Stops listening for incoming HTTP requests.
GetContext()
Waits for an incoming request and returns an HttpListenerContext
object representing the request.
HttpListenerContext
object.See full documentation for HttpListener...
WebClient
provides a simple way to download or upload data. It's often used for basic file transfers or fetching simple web content.
DownloadString(string address)
Downloads a string resource from the specified URI.
address
Uri
of the resource to download.UploadString(string address, string data)
Uploads a string to the specified URI.
address
Uri
to upload the string to.data
See full documentation for WebClient...
The IPAddress
class represents an Internet Protocol (IP) address and is fundamental for network communication.
AddressFamily
Gets the address family of the IP address (e.g., IPv4 or IPv6).
IsIPv4MappedToIPv6
Gets a value indicating whether the IP address is an IPv4-mapped IPv6 address.
Parse(string ipString)
Converts the string representation of an IP address to an IPAddress
instance.
ipString
IPAddress
instance.See full documentation for IPAddress...
The Dns
class provides methods for resolving domain names to IP addresses and vice versa.
GetHostEntry(string hostNameOrAddress)
Resolves the specified host name or IP address to an xref:System.Net.IPHostEntry instance.
hostNameOrAddress
GetHostName()
Gets the host name of the local computer.
See full documentation for Dns...
The Socket
class provides the Windows Sockets API
for network communication. It offers low-level control over network operations.
SocketType
Gets the socket type.
ProtocolType
Gets the protocol type.
Bind(EndPoint localEP)
Binds a Socket
to a local endpoint.
localEP
Connect(EndPoint remoteEP)
Establishes a connection to a remote host.
remoteEP