📜  c# ip address translate localhost - C# 代码示例

📅  最后修改于: 2022-03-11 14:48:54.331000             🧑  作者: Mango

代码示例2
IPAddress address = Dns.GetHostAddresses("localhost").Where(x => x.AddressFamily == AddressFamily.InterNetwork).First();
Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
socket.Bind(new IPEndPoint(address, port));