在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
Server: serverSocket = new Socket(AddressFamily.InterNetworkV6, SocketType.Stream, ProtocolType.Tcp); serverSocket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true); if (!string.IsNullOrEmpty(SocketBindingIP)) { serverSocket.Bind(new IPEndPoint(IPAddress.IPv6Any, int.Parse(Program.config.AppSettings.Settings["Middleware_PORT"].Value))); lbWebApiBaseAddress.Text = ip; LogMessage(DateTime.Now + "->Socket开启IPV6监听成功,监听IP:" + IPAddress.IPv6Any.ToString() + ":" + Program.config.AppSettings.Settings["Middleware_PORT"].Value); } else { serverSocket.Bind(new IPEndPoint(IPAddress.Parse(ip), int.Parse(Program.config.AppSettings.Settings["Middleware_PORT"].Value))); lbWebApiBaseAddress.Text = IPAddress.Parse(ip).ToString(); LogMessage(DateTime.Now + "->Socket开启IPV6监听成功,监听IP:" + IPAddress.Parse(ip) + ":" + Program.config.AppSettings.Settings["Middleware_PORT"].Value); }
client: m_clientSocket = new Socket(AddressFamily.InterNetworkV6, SocketType.Stream, ProtocolType.Tcp); m_clientSocket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true); EndPoint ipeh_Server = new IPEndPoint(IPAddress.Parse(textBox1.Text), Convert.ToInt32(textBox2.Text)); if (!m_clientSocket.IsBound) { if (comboBox1.Text == "自动分配") { m_clientSocket.Bind(new IPEndPoint(IPAddress.IPv6Any, 0)); } else { m_clientSocket.Bind(new IPEndPoint(IPAddress.IPv6Any, Convert.ToInt32(comboBox1.Text))); } }
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论