- 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.
- Mastering ServiceStack
- 高效微控制器C語言編程
- Vue.js快跑:構(gòu)建觸手可及的高性能Web應(yīng)用
- SAS數(shù)據(jù)統(tǒng)計(jì)分析與編程實(shí)踐
- PLC編程與調(diào)試技術(shù)(松下系列)
- Cocos2d-x學(xué)習(xí)筆記:完全掌握Lua API與游戲項(xiàng)目開發(fā) (未來書庫)
- C語言課程設(shè)計(jì)
- Mastering Android Game Development
- Java網(wǎng)絡(luò)編程實(shí)戰(zhàn)
- SQL Server 入門很輕松(微課超值版)
- 大規(guī)模語言模型開發(fā)基礎(chǔ)與實(shí)踐
- Blender 3D Cookbook
- 川哥教你Spring Boot 2實(shí)戰(zhàn)
- 秒懂算法:用常識(shí)解讀數(shù)據(jù)結(jié)構(gòu)與算法
- Learning IBM Bluemix