开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜