System.Net.Methods

Provides classes for network programming.

Classes

IPAddress

public sealed class IPAddress

Represents an Internet Protocol (IP) address.

Details >>

IPEndPoint

public sealed class IPEndPoint

Represents a network endpoint as an IP address and a port number.

Details >>

Socket

public class Socket

Provides support for the Microsoft .NET implementation of the Windows Socket API.

Details >>

NetworkStream

public class NetworkStream

Provides the underlying stream of bytes for network access.

Details >>

Dns

public static class Dns

Provides services for resolving domain names into IP addresses.

Details >>

Common Tasks & Examples

Creating an IPAddress object

public static IPAddress Parse(string ipString)

Parses an IP address string into an IPAddress instance.

// C# Example var ipAddress = IPAddress.Parse("192.168.1.1"); Console.WriteLine($"Parsed IP: {ipAddress}");
See Method Details >>

Creating an IPEndPoint

public IPEndPoint(IPAddress address, int port)

Initializes a new instance of the IPEndPoint class with the specified IP address and port number.

// C# Example var ipAddress = IPAddress.Parse("127.0.0.1"); var endPoint = new IPEndPoint(ipAddress, 8080); Console.WriteLine($"Created EndPoint: {endPoint}");
See Constructor Details >>

Resolving a Host Name

public static IPAddress[] GetHostAddresses(string hostNameOrAddress)

Resolves a host name or IP address into an array of IPAddress instances.

// C# Example var addresses = Dns.GetHostAddresses("www.example.com"); foreach (var address in addresses) { Console.WriteLine($"Resolved Address: {address}"); }
See Method Details >>