Hi,
We're having problems with the standard Socket module with Ruby. It has
been alleged that this might be a C Runtime issue. But this seems
unlikely in light of the fact that other ports on the same platform --
notably Perl, and perhaps also Python -- have working sockets, also
implemented on top of the same C Runtime.
Can someone shed some light on what may be going on?
Here is a failing case, as we first reported the problem:
client.rb:
require 'socket'
s=TCPSocket.new("localhost", ARGV[0])
s.puts("test\r\n")
puts s.gets
s.puts("Blah, blah\r\n")
puts s.gets
s.close
server.rb:
require 'socket'
gs = TCPServer.open(0)
printf("server is on port %d\n", gs.addr[1])
s=gs.accept
line = s.gets
puts("Got line: #{line}")
s.puts(line.upcase)
bl = s.gets
puts ("Got str2: #{bl}")
s.puts(bl.upcase)
s.close
On Linux (ruby 1.8.2), this gave the following output, as expected:
(client side)
TEST
BLAH, BLAH
(server side)
server is on port 40050
Got line: test
Got str2: Blah, blah
On OpenVMS (ruby 1.8.1), this surprisingly gave the following output:
(client side)
test
test
(server side)
server is on port 49379
Got line: test
Got str2: test
We tried varying the test by changing our puts to write on the client
side, but the test results were the same on both platforms.
Thanks,
Ben Armstrong
--
Ben Armstrong -. Medianet Development Group,
BArmstrong / dymaxion.ca `-. Dymaxion Research Limited
<URL: http://www.dymaxion.ca/> `- Halifax, Nova Scotia, Canada