Socket的ip_freebind选项可以提前绑定一个本机不存在的ip

July 22, 2022 | 0 Minute Read

启用这个选项后,可以绑定一个本机不存在的ip。

	int freebind = 1;
	setsockopt(sockfd, IPPROTO_IP, IP_FREEBIND, &freebind, sizeof(freebind));