Skip to content

Commit

Permalink
Update socket_setttl_ttl.md
Browse files Browse the repository at this point in the history
  • Loading branch information
wangdejun authored Dec 24, 2017
1 parent 257922f commit 7106bb1
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions dgram/socket_setttl_ttl.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,9 @@ added: v0.1.101

* `ttl` {number} Integer

Sets the `IP_TTL` socket option. While TTL generally stands for "Time to Live",
in this context it specifies the number of IP hops that a packet is allowed to
travel through. Each router or gateway that forwards a packet decrements the
TTL. If the TTL is decremented to 0 by a router, it will not be forwarded.
Changing TTL values is typically done for network probes or when multicasting.

The argument to `socket.setTTL()` is a number of hops between 1 and 255.
The default on most systems is 64 but can vary.
设置 `IP_TTL` 套接字选项。
一般来说,TTL表示"生存时间",这里特指一个IP数据包传输时允许的最大跳步数。
当IP数据包每向前经过一个路由或网关时,TTL值减1,若经过某个路由时,TTL值被减至0,便不再继续向前传输。
比较有代表性的是,为了进行网络情况嗅探或者多播而修改TTL值。

传给 `socket.setTTL()` 的参数是一个范围为0-255的跳步数。大多数系统的默认值是 `1` ,但是可以变化。

0 comments on commit 7106bb1

Please sign in to comment.