- Full Stack Web Development with Raspberry Pi 3
- Soham Kamani
- 372字
- 2021-07-15 17:10:26
The network
A single computer on its own can achieve a lot, but its capability becomes exponentially larger when it can communicate with other computers. This communication occurs among computers that belong to the same network.
A computer can be a part of a network through various means: such as an Ethernet cable or through Wi-Fi. In the previous chapter, we observed the output of the ifconfig command, which showed us the different interfaces through which our device could possibly be connected.
Now that we know a network can have multiple computers, the next question that arises is about how each computer is identified on the network. This is what each device's IP address (or IPv4 address, to be more precise) is used for. It specifies the location and acts as an identifier for each device connected to a network.

The dotted boundary in the figure represents a single network. For each individual network, every device must have a unique IP address. This IP address is only unique for a single network. If you notice, there are two devices that have the IP address of 192.168.0.4, which is fine since they are on different networks.
Our Raspberry Pi is nothing special. In the previous chapter, we found the Pi's IP address for the network that it was connected to.
Although each device has its own IP address, there will still be many services running on it. For example, we can have a web server and database running on our Pi at the same time, and both services must be communicated with independently. This is what ports are for.
Each port on a single device refers to one single service running on that device. As a principle, every program that needs to communicate with the outside world requires a port. Each device has port numbers ranging from 0 to 65535. Ports ranging from 0 till 1024 are reserved, and any port numbers after that can be used for our applications. Since we will be running most of our services on our Pi device itself, we will use a different port for each of them.
- Boost程序庫完全開發指南:深入C++”準”標準庫(第5版)
- PHP+MySQL網站開發技術項目式教程(第2版)
- Servlet/JSP深入詳解
- Mastering Yii
- C語言程序設計
- C程序設計案例教程
- Learning OpenStack Networking(Neutron)
- Android Wear Projects
- Linux C編程:一站式學習
- Spring 5 Design Patterns
- 從Power BI到Analysis Services:企業級數據分析實戰
- Python預測分析實戰
- SEO教程:搜索引擎優化入門與進階(第3版)
- Docker:容器與容器云(第2版)
- Building Clouds with Windows Azure Pack