Skip to content

Commit ee851ca

Browse files
authored
Update TCPSocket.md
TCPSocket.new のオプションを追加しました。 https://speakerdeck.com/coe401_/the-less-told-story-of-socket-timeouts の発表に基づいた内容となっています。 resolv_timeout オプションは 3.0 で追加されたものの効果はなく、3.4 から利用できるようになったということで、since 3.4 として記述しています。
1 parent 567765b commit ee851ca

1 file changed

Lines changed: 21 additions & 4 deletions

File tree

manual/api/socket/TCPSocket.md

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,23 @@ s.close
2929

3030
## Class Methods
3131

32+
#@since 4.0
33+
### def open(host, service, local_host=nil, local_service=nil, resolv_timeout: nil, connect_timeout: nil, open_timeout: nil, fast_fallback: true) -> TCPSocket
34+
### def new(host, service, local_host=nil, local_service=nil, resolv_timeout: nil, connect_timeout: nil, open_timeout: nil, fast_fallback: true) -> TCPSocket
35+
#@else
36+
#@since 3.4
37+
### def open(host, service, local_host=nil, local_service=nil, resolv_timeout: nil, connect_timeout: nil, fast_fallback: true) -> TCPSocket
38+
### def new(host, service, local_host=nil, local_service=nil, resolv_timeout: nil, connect_timeout: nil, fast_fallback: true) -> TCPSocket
39+
#@else
3240
#@since 3.0
3341
### def open(host, service, local_host=nil, local_service=nil, connect_timeout: nil) -> TCPSocket
3442
### def new(host, service, local_host=nil, local_service=nil, connect_timeout: nil) -> TCPSocket
3543
#@else
3644
### def open(host, service, local_host=nil, local_service=nil) -> TCPSocket
3745
### def new(host, service, local_host=nil, local_service=nil) -> TCPSocket
3846
#@end
47+
#@end
48+
#@end
3949

4050
host で指定したホストの service で指定したポートと接続したソケッ
4151
トを返します。host はホスト名、またはインターネットアドレスを
@@ -51,12 +61,19 @@ host で指定したホストの service で指定したポートと接続した
5161
- **param** `service` -- /etc/services (または NIS) に登録されているサービス名かポート番号を指定します。
5262
- **param** `local_host` -- ホスト名、またはインターネットアドレスを示す文字列を指定します。
5363
- **param** `local_service` -- /etc/services (または NIS) に登録されているサービス名かポート番号を指定します。
64+
#@since 3.4
65+
- **param** `resolv_timeout` -- 名前解決のタイムアウトを秒数で指定します。
66+
#@end
5467
#@since 3.0
55-
#@# getaddrinfo_a(3) が入らなかったので、3.0 では resolv_timeout は指定しても無視される
56-
#@# https://github.com/ruby/ruby/commit/c6b37cb169f190bac46c76a643350ee4ffc3dfca
57-
#@#@param resolv_timeout 名前解決のタイムアウトを秒数で指定します。
58-
- **param** `connect_timeout` -- タイムアウトを秒数で指定します
68+
- **param** `connect_timeout` -- 接続確立のタイムアウトを秒数で指定します
69+
#@end
70+
#@since 4.0
71+
- **param** `open_timeout` -- 名前解決から接続確立までのタイムアウトを秒数で指定します
5972
#@end
73+
#@since 3.4
74+
- **param** `fast_fallback` -- Happy Eyeballs Version 2 ([RFC 8305](https://datatracker.ietf.org/doc/html/rfc8305)) を有効にします。
75+
#@end
76+
6077
### def gethostbyname(host) -> Array
6178

6279
ホスト名または IP アドレス (整数または"127.0.0.1"

0 commit comments

Comments
 (0)