This program works with ruby and jruby but it does not work with iron ruby. I get the following error: multi-client-tcp-server.rb:29: can't convert Fixnum into String (TypeError) I'm new to ruby. Can someone help me fix this so it will work with both ruby, jruby and ironruby? Thanks! Siegfried #!/usr/bin/ruby # # http://www.tutorialspoint.com/ruby/ruby_socket_pro... require 'socket' # Get sockets from stdlib server = TCPServer.open(2000) # Socket to listen on port 2000 print "hello\n" loop { # Servers run forever Thread.start(server.accept) do |client| client.puts(Time.now.ctime) # Send the time to the client client.puts "Closing the connection. Bye!" client.close # Disconnect from the client end }
on 2011-07-08 18:16
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.