From: Mitsuru Ogino Date: 2003-08-19T10:28:23+09:00 Subject: [ruby-list:38141] Re: ポートが閉じているときの例外など 荻野です。 # すみません、私には理解できない点が多々あるんですが... On 2003.8.19, at 01:44 Asia/Tokyo, Takahiro Kambe wrote: >> 対応としては、FreeBSD(*BSD全部?)でもWAIT_IN_PROGRESSを有効にす >> るということでいいんでしょうか。全システムで有効にしたほうがい >> いのかな? > FreeBSDの最新のものはチェックできません。 > > http://www.netbsd.org/cgi-bin/query-pr-single.pl?number=22522 > > に含めたテストプログラムを後ろに付けます。PR(Problem Report)にも書きま > したが、connect(2)でEINVALになる場合は、 > > % cc test.c > % ./a.out 192.168.32.10 12345 > connect to family = 2, port = 234, addr = 192.168.32.10 > connect: Operation now in progress > getsockopt => Connection refused > connect to family = 2, port = 234, addr = 192.168.32.10 > connect: Invalid argument > getsockopt => 0 > > となります。 FreeBSD の最新というわけではありませんが、5.1R で添付されていたテストを 実行してみました。uname -a の結果は適当に折り返してあります。 $ uname -a FreeBSD xxx.verama.net 5.1-RELEASE FreeBSD 5.1-RELEASE #1: Mon Aug 11 21:39:49 JST 2003 root@xxx.xxx.xxx:/usr/src/sys/i386/compile/VIC i386 $ ./a.out 192.168.0.xxx 12345 connect to family = 2, port = 12345, addr = 192.168.0.xxx connect: Operation now in progress getsockopt => 0 connect to family = 2, port = 12345, addr = 192.168.0.xxx connect: Operation already in progress $ ./a.out localhost 12345 connect to family = 2, port = 12345, addr = 127.0.0.1 connect: Operation now in progress getsockopt => Connection refused connect to family = 2, port = 12345, addr = 127.0.0.1 connect: Invalid argument getsockopt => 0 もうひとつ MacOS X 10.2.6(6L60) もつけておきます。 $ uname -a Darwin xxx.xxx.xxx 6.6 Darwin Kernel Version 6.6: Thu May 1 21:48:54 PDT 2003; root:xnu/xnu-344.34.obj~1/RELEASE_PPC Power Macintosh powerpc $ ./a.out 192.168.0.xxx 12345 connect to family = 2, port = 12345, addr = 192.168.0.xxx connect: Operation now in progress getsockopt => Connection refused connect to family = 2, port = 12345, addr = 192.168.0.xxx connect: Invalid argument getsockopt => 0 $ ./a.out localhost 12345 connect to family = 2, port = 12345, addr = 127.0.0.1 connect: Operation now in progress getsockopt => Connection refused connect to family = 2, port = 12345, addr = 127.0.0.1 connect: Invalid argument getsockopt => 0 参考になれば幸いです。 -- 荻野 充 (おぎの みつる) ... 「萩(はぎ)」にあらず Verama Systems Key fingerprint = 7F26 5414 1805 F31B 1617 10B7 C117 07AE 1691 9BD1