* io.c (rb_open_file): encoding in mode string was ignored if perm is
[ruby-svn.git] / test / socket / test_tcp.rb
blob3aa7be82c32b31257930adcc9c8051544136923a
1 begin
2   require "socket"
3   require "test/unit"
4 rescue LoadError
5 end
8 class TestTCPSocket < Test::Unit::TestCase
9   def test_recvfrom
10 assert false, "TODO: doesn't work on mswin32/64" if /mswin/ =~ RUBY_PLATFORM
11     svr = TCPServer.new("localhost", 0)
12     th = Thread.new {
13       c = svr.accept
14       c.write "foo"
15       c.close
16     }
17     addr = svr.addr
18     sock = TCPSocket.open(addr[2], addr[1])
19     assert_equal(["foo", nil], sock.recvfrom(0x10000))
20   ensure
21     th.kill
22     th.join
23   end
24 end if defined?(TCPSocket)