[问答] 有关基础网络 TCP client-server

楼主: gowrite (gowrite)   2017-10-13 09:54:42

上图中 , 有关于下面用红框框起来的那段叙述 ,
其中有几段话不太理解 ,
第一段不太了解的是
/*
If the host on which the server is running is multihomed (as in this example)
, the server can specify that it wants only to accept incoming connetions
that arrive destined to one specific local interface.
这段话是不是说 ,
如果 server 本身有多重 IP , 不论是
public IP 12.106.32.254

private IP 192.168.42.1
都可以设定为外来连线的连线接口 (local interface)
但是如果连 WAN 的 IP 指定成 192.168.42.1 那应该连不进来吧?
client 发出连线的时候 , 应该是找都找不到
所以 192.168.42.1 是单纯指 LAN 端的其他设备可以连到 server 的选择吗?
这段话这样理解是对的吗??
*/
另外第二段话
/*
This is a one-or-any choice for the server. The server cannot specify a list
of multiple addresses.
The wildcard local address is the "any" choice. the wildcard address was
specified by setting the IP address in the socket address structure to
INADDR_ANY before calling bind.
这边这段话又说
如果不是选择指定对外 IP , 那就是选择 any IP
可是如果在这个例子的话 , 一个 public IP , 一个 private IP
那 FTP server 会自动确认自己目前所拥有的 IP 是哪一个网段,
哪一个 public IP, 哪一个是 private IP ,
然后再指定外来的 request connection 要跟哪一个 IP 连线吗?
*/
关于这一小段话 , 不太理解 , 希望有人可以解点解惑
谢谢。

Links booklink

Contact Us: admin [ a t ] ucptt.com