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)));
}
}

最新文章

  1. Flume(2)组件概述与列表
  2. iOS UIAlertView添加输入框
  3. Memcached Java Client API详解
  4. B.xml
  5. 【转】成为it精英,我奋斗7年
  6. Spring实战——无需一行xml配置实现自动化注入
  7. bzoj 1604 [Usaco2008 Open]Cow Neighborhoods 奶牛的邻居(set+并查集)
  8. res://ieframe.dll/acr_error.htm 纯手动解决方法
  9. linux下创建可引导的U盘系统,使用dd命令进行Linux的ghost
  10. [js高手之路]深入浅出webpack教程系列8-(postcss-loader,autoprefixer,html-loader,less-loader,ejs-loader)用法
  11. docker基本原理
  12. js精度误差
  13. 微信h5支付demo微信H5支付demo非微信浏览器支付demo微信wap支付
  14. php页面开启错误提示
  15. cmd如何进入d盘
  16. JS两种事件的触发方式
  17. Python-统计svn变更代码行数
  18. NodeJs实现客户端登陆
  19. appium===浮窗无法定位的解决办法
  20. JQ自定义下拉列表插件

热门文章

  1. 使用Redis作为Spring Security OAuth2的token存储
  2. Dockerfile 中的 CMD 与 ENTRYPOINT(转)
  3. Spring-AOP源码分析随手记(二)
  4. Swagger实例分享(VS+WebApi+Swashbuckle)
  5. WPF中获取Hwnd与窗体,Uid获取控件
  6. ASP.NET Core appsettings.json 文件
  7. 宣布Visual Studio Code Installer for Java
  8. MVC 创建Controllers 发生 EntityType has no key defined error
  9. C typedef、#define
  10. 原生JavaScript HTML DOM Style 对象参考