Skip to content

Instantly share code, notes, and snippets.

@define-private-public
Created July 12, 2016 02:29
Show Gist options
  • Save define-private-public/aab810577cdb9ff3af59570fc68c2566 to your computer and use it in GitHub Desktop.
Save define-private-public/aab810577cdb9ff3af59570fc68c2566 to your computer and use it in GitHub Desktop.
Example usage of IPEndPoint
// Filename: IPEndPointExample.cs
// Author: Benjamin N. Summerton <define-private-public>
// License: Unlicense (http://unlicense.org/)
using System;
using System.Net;
namespace IPEndPointExample
{
class IPEndPointExample
{
public static void Main(string[] args)
{
// Print some static info
Console.WriteLine("Min. Port: {0}", IPEndPoint.MinPort);
Console.WriteLine("Max. Port: {0}", IPEndPoint.MaxPort);
Console.WriteLine();
// Create one
IPEndPoint endPoint = new IPEndPoint(IPAddress.Parse("107.70.178.215"), 6000);
Console.WriteLine("Address: {0}", endPoint.Address);
Console.WriteLine("Port: {0}", endPoint.Port);
Console.WriteLine("Address Family: {0}", endPoint.AddressFamily);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment