I. Knowledge Summary
✨ Concept of Computer Networks
A computer network is a system formed by connecting multiple computing devices through communication lines, mainly used for:
- Data exchange: Transferring information between devices
- Information sharing: Multiple users accessing the same resource
- Resource utilization: Sharing printers, storage, and other hardware resources
✨ Classification of Computer Networks
By Geographic Range
| Abbreviation | Full Name | Coverage | Example |
|---|
| PAN | Personal Area Network | A few meters | Bluetooth earbuds connecting to a phone |
| LAN | Local Area Network | A building/campus | School computer lab |
| MAN | Metropolitan Area Network | A city | City cable TV network |
| WAN | Wide Area Network | Across cities/countries | The Internet |
By Ownership
| Type | Description |
|---|
| Public Network | Accessible to everyone, e.g., the Internet |
| Private Network | Used within a specific organization, e.g., corporate intranet |
By Topology
| Topology | Characteristics |
|---|
| Star | All devices connect to a central node |
| Bus | All devices share a single main line |
| Ring | Devices connected end-to-end forming a ring |
| Tree | Hierarchical structure, like an org chart |
| Mesh | Multiple paths between devices |
✨ Components of Computer Networks
| Component | Contents | Description |
|---|
| End Devices | PCs, smartphones, servers | Network users |
| Network Interconnection Devices | Modems, switches, routers | Connect and forward data |
| Transmission Media | Fiber optic, radio waves, twisted pair | Physical channels for data |
| Network Protocols & Software | Transport protocols, service software, applications | Rules governing data transmission |
Network Device Comparison
| Device | Function | Address Used | Example |
|---|
| Modem | Converts between analog and digital signals | — | Connecting to Internet via phone line |
| Hub/Switch | Connects devices within a single network | MAC address | Connecting devices in a computer lab |
| Router | Connects devices across one or more networks | IP address | WiFi router |
✨ Internet Protocols
Common Protocols
| Protocol | Full Name | Purpose |
|---|
| IP | Internet Protocol | Routes data from source to destination |
| TCP | Transmission Control Protocol | Provides reliable data transfer with integrity and ordering |
| UDP | User Datagram Protocol | Fast transmission without guaranteed accuracy or completeness |
| DNS | Domain Name System | Converts domain names to IP addresses |
| HTTP | Hypertext Transfer Protocol | Transmits web content in plain text |
| HTTPS | Hypertext Transfer Protocol Secure | Transmits web content with encryption |
| FTP | File Transfer Protocol | Transfers files |
| SMTP/POP3/IMAP | Email Protocols | Sends and receives email |
TCP vs UDP
| TCP | UDP |
|---|
| Reliability | Reliable, ensures data integrity and ordering | Unreliable, may lose packets |
| Speed | Slower (requires connection establishment) | Faster (connectionless) |
| Use Cases | Web browsing, file downloads | Video streaming, online gaming |
IP Addresses
An IP address is a network address based on the IP protocol, used to identify each device on the network. There are two versions:
| IPv4 | IPv6 |
|---|
| Format | Dotted decimal (four groups) | Colon-separated (eight hex groups) |
| Binary bits | 32 bits | 128 bits |
| Minimum address | 0.0.0.0 | — |
| Maximum address | 255.255.255.255 | — |
| Example | 192.168.1.1 | 2001:0db8:85a3:0000:0000:8a2e:0370:7334 |
TCP Connection: Three-Way Handshake
Used to establish a TCP connection, ensuring both parties are ready for data transmission.
| Step | Direction | Packet | Meaning |
|---|
| 1st | Client → Server | SYN | Request to establish connection |
| 2nd | Server → Client | SYN-ACK | Agree to connect, confirm receipt |
| 3rd | Client → Server | ACK | Confirm receipt, connection established |
TCP Disconnection: Four-Way Handshake
Used to terminate a TCP connection, ensuring both parties safely release resources.
| Step | Direction | Packet | Meaning |
|---|
| 1st | Client → Server | FIN | Request to terminate connection |
| 2nd | Server → Client | ACK | Confirm receipt of termination request |
| 3rd | Server → Client | FIN | Agree to close connection |
| 4th | Client → Server | ACK | Confirm receipt, connection closed |
✨ Domain Names
Basic Concept
A domain name is an easy-to-remember name used to identify computers on the Internet, replacing numeric IP addresses.
Domain names have a hierarchical structure read from right to left: fourth-level.third-level.second-level.top-level domain
Common Top-Level Domains
| Type | Domain | Meaning |
|---|
| Country TLD | .cn | China |
| .us | United States |
| .uk | United Kingdom |
| International TLD | .int | International organizations |
| Generic TLD | .edu | Educational institutions |
| .gov | Government agencies |
| .com | Commercial organizations |
| .org | Non-profit organizations |
| .mil | Military |
Domain Hierarchy
With only three levels, the third-level domain can indicate the service type:
| Domain | Third-Level | Meaning |
|---|
| www.qq.com | www | Website homepage |
| mail.qq.com | mail | Email service |
II. Homework
Programming Exercises
- n×n Multiplication Table: L1151
- Primes Within n: L1152
- Hundred Chickens Problem: L1153
- Number Black Hole: L1154
Knowledge Quiz