开发者

How to set local IP when originating TCP/IP connections?

开发者 https://www.devze.com 2023-02-08 23:34 出处:网络
Using Linux and glibc, wh开发者_StackOverflow中文版en originating a TCP/IP connection (calling connect() on a socket), how can I choose explicitly from which of my IP local adresses I want to originat

Using Linux and glibc, wh开发者_StackOverflow中文版en originating a TCP/IP connection (calling connect() on a socket), how can I choose explicitly from which of my IP local adresses I want to originate that connection, providing I have more than one interface (with different IPs) from where I can reach the remote host?

Is it possible to do so, or it is always up to the operating system IP stack to chose the route automatically?


Bind to a specific address instead of 0.0.0.0 or ::.

0

精彩评论

暂无评论...
验证码 换一张
取 消