Getting Started with Python for the Internet of Things
上QQ阅读APP看书,第一时间看更新

Direct network link

For a network link to work between two computers, they need to be using the same address range. The allowable address range is determined by the subnet mask (for example, 255.255.0.0 or 255.255.255.0 would mean all IP addresses should be the same except for the last two, or just the last number in the IP address; otherwise, they will be filtered).

To use a direct link without enabling ICS, check the IP settings of the adapter you are
going to connect to and determine whether it is automatically allocated or fixed to a
specific IP address.

Most PCs connected directly to another computer will allocate an IP address in the range 169.254.X.X (with a subnet mask of 255.255.0.0). However, we must ensure that the network adaptor is set to Obtain an IP address automatically.

For Raspberry Pi to be able to communicate through the direct link, it needs to have an IP address in the same address range, 169.254.X.X. As mentioned before, Raspberry Pi will automatically give itself a suitable IP address and connect to the network.

Therefore, assuming we have Apple Bonjour (mentioned previously), we only need to know the hostname given to Raspberry Pi (raspberrypi).