[問答] 有關基礎網路 TCP client-server

作者: gowrite (gowrite)   2017-10-13 09:54:42
https://imgur.com/a/N5GGU
上圖中 , 有關於下面用紅框框起來的那段敘述 ,
其中有幾段話不太理解 ,
第一段不太了解的是
/*
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