4 class TestKgioSyssend < Test::Unit::TestCase
6 @host = '127.0.0.1' || ENV["TEST_HOST"]
10 srv = Kgio::TCPServer.new(@host, 0)
12 client = TCPSocket.new(@host, port)
14 th = Thread.new { client.readpartial(4) }
16 assert_nil acc.kgio_syssend("HI", Socket::MSG_DONTWAIT | Socket::MSG_MORE)
17 assert_nil acc.kgio_syssend("HI", Socket::MSG_DONTWAIT)
18 assert_equal "HIHI", th.value
22 case rv = acc.kgio_syssend(buf, Socket::MSG_DONTWAIT)
30 assert_equal :wait_writable, res.last
32 assert_kind_of String, res[-2]
38 th = Thread.new { loop { acc.kgio_syssend("ZZZZ", 0) } }
39 assert_nil th.join(0.1)
41 assert th.join(10), 'thread should be killed'
43 [ srv, acc, client ].each { |io| io.close if io }
45 end if RUBY_PLATFORM =~ /linux/ && Socket.const_defined?(:MSG_MORE)