forked from hantmac/Mastering_Go_ZH_CN
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
30 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# **关于IPv4和IPv6** | ||
|
||
**IP协议**的第一个版本称为**IPv4**;为表示区分,最新版本的IP协议被称为**IPv6**。 | ||
|
||
当前IPv4协议的主要问题是IP地址即将耗尽,这也是创建IPv6协议的主要原因。IPv4协议地址耗尽的原因是一个IPv4地址只使用32位来表示,它可以表示出2的32次方(4294967296)个不同的IP地址。而IPv6使用128位定义一个地址。 | ||
|
||
IPv4地址的格式为```10.20.32.245```(用点分隔的四段),而IPv6地址的格式为```3fce:1706:4523:3:150:f8ff:fe21:56cf```(用冒号分隔的八段)。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# **命令行工具netcat** | ||
|
||
命令行工具```nc(1)```,全称```netcat(1)```,在测试TCP/IP的客户端和服务端时非常便利。本节将介绍它的一些常见用法。 | ||
|
||
```nc(1)```可以作为TCP服务的客户端使用,例如,作为客户端连接监听在端口```1234```的服务器主机```10.10.1.123```,命令如下: | ||
|
||
> ```shell | ||
> nc 10.10.1.123 1234 | ||
> ``` | ||
命令行工具```nc(1)```默认使用TCP协议。如果使用UDP协议,可以在执行```nc(1)```命令时携带```-u```参数。 | ||
如果要使用```netcat(1)```模拟服务器,可以携带```-l```参数,```netcat(1)```将监听指定端口号的连接。 | ||
如果希望```netcat(1)```生成详细的输出,可以使用```-v```和```-vv```参数,这些输出对排查网络连接故障提供了很大的便利。 | ||
```netcat(1)```不仅可以测试HTTP应用程序,在第13章*网络编程 - 构建服务器与客户端*中,它同样可以灵活的使用,用于开发TCP和UDP协议的客户机和服务器。在本章中后续的一个例子中,````netcat(1)```将作为案例使用。 |