当前位置:网站首页>IPv6 related
IPv6 related
2022-04-22 14:03:00 【qq_ twenty-three million nine hundred and fifty-three thousand 】
Address already in use
When listening to a port at the same time IPv4 and IPv6 when , function bind The function will fail to execute , Tips “bind : Address already in use”.
reason :ipv6 Of socket By default, you will also receive ipv4 Message of , Different socket Cannot monitor the same IP The same port under
Method : Set up ipv6 Of socket Only receive ipv6 Address message
int on = 1;
if(0 > setsockopt(fd_v6, IPPROTO_IPV6, IPV6_V6ONLY, &on, sizeof(on)))
{
perror("setsockopt");
return -1;
}
IPv6 relevant
- fe80 Local link IPv6 Address , For local use only , Cannot be used for outbound communications
- visit ipv6 Of web The server http://[fe80::aa:bb:cc:dd], Bracketed access
- ping IPv6, If it is fe80 At the beginning , be ping6 fe80::aa:bb:cc:dd%xx, add to % Add the network card name after it
- ping IPv6, If the fe80 At the beginning , be ping6 fe80::aa:bb:cc:dd that will do
- Use boost When adding a network link ,IPv6 Should also be fe80::aa:bb:cc:dd%xx Only then can
How to use boost Of asio Realize simultaneous monitoring IPv4 and IPv6
boost::asio::io_service io_serv;
boost::asio::ip::tcp::acceotpr acceotor_v4(io_serv);
boost::asio::ip::tcp::acceotpr acceotor_v6(io_serv);
acceotor_v4.open(ip::tcp::v4());
acceotor_v6.open(ip::tcp::v6());
Set properties
// Set up IPv6 Receive only IPv6 Address
setsockopt(fd_v6, IPPROTO_IPV6, IPV6_V6ONLY, &on, sizeof(on);
No address binding
// binding IPv4
acceotor_v4.bind(ip::tcp::endpoint(ip::tcp::v4(), port));
// binding IPv6
acceotor_v6.bind(ip::tcp::endpoint(ip::tcp::v6(), port));
Address binding
boost::asio::ip::address addr = boost::asio::ip::address::from_string(ip);
acceotor_v4.bind(ip::tcp::endpoint(addr, port));
版权声明
本文为[qq_ twenty-three million nine hundred and fifty-three thousand ]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204221358370608.html
边栏推荐
- QT 资源管理器和.qrc文件的使用
- How to use openfeign to call the third-party interface
- 将pyrcc5添加到Pycharm的外部工具
- 将pyuic添加到Pycharm的外部工具
- Ebpf learning - getting started
- 处理高并发问题思路
- Detailed explanation of channel implementation of cocoyaxi Library
- Is it effective to control caching through meta information in HTML files? Is it used much at present?
- PLSQL developer file encoding format setting
- 2022 welder (elementary) examination questions and answers
猜你喜欢

华为云媒体査勇:华为云在视频AI转码领域的技术实践

二月份,我靠这一份PDF文档面试BAT,没想到竟然收到了5个offer

机器越“智能”,数据标注员越容易被淘汰?丨曼孚科技

"Precise investment promotion" of digital operation and management of Industrial Park
![Genesis creative comics [stable pass]](/img/14/30e0288119d77f37e5d44af857b149.jpg)
Genesis creative comics [stable pass]

Fastdfs installation and configuration

独立站运营 | 6个Facebook推广小技巧,你都知道吗?

产业园区数字化运营管理之“精准招商”篇

Mathorcup ideas sharing in 2022

translucentTB汉化界面 - 菜单汉化 - 怎么使用 - win11任务栏透明效果
随机推荐
Recall, this year (Huashi 918 blood and tears paste)
Exercises and answers for the examination of main principals of hazardous chemical business units in 2022
树莓派开发笔记(十二):入手研华ADVANTECH工控树莓派UNO-220套件(一):介绍和运行系统
Super user of oceanbase - system tenant sys
回忆,这一年(华师918血泪贴)
On QPS, TPS, number of concurrent users and throughput
单阶段和两阶段目标检测
【终于等到你】微信转发语音的方法 - 语音信息转发
关于QPS、TPS、并发用户数及吞吐量浅谈
银行为什么要上堡垒机?选择哪家好?有案例吗?
【Zeekr_Tech】ROS/ROS 2介绍
redis连接工具无法连上docker中redis
Genesis public chain gives Dao new vitality
LeetCode-3 无重复字符的最长子串
[finally waiting for you] wechat voice forwarding method - voice message forwarding
日志脱敏是什么意思?为什么要做日志脱敏?
Leetcode-3 longest substring without duplicate characters
Detailed explanation of heap sorting (C language)
The more "intelligent" the machine is, the easier it is for data taggers to be eliminated? Manfu Technology
BCC-stackcount