A string that contains information about the System.Net.SocketAddress.
The SocketAddress.ToString method returns a string that contains the System.Net.Sockets.AddressFamily enumerated value, the size of the underlying buffer of the System.Net.SocketAddress structure, and the remaining contents of the buffer.
The following example writes a socket address to the console.
C# Example
using System; using System.Net; using System.Net.Sockets; public class SocketAddressToString{ public static void Main() { Console.WriteLine("This is a minimal SocketAddress."); SocketAddress socketAddress = new SocketAddress(AddressFamily.InterNetwork); Console.WriteLine("{0}", socketAddress.ToString()); } }
The output is
This is a minimal SocketAddress.