This works, but I don't know how to get out of the loop. I'm running this on windows xp.
I tried control-c, but it doesn't work. How can I get out of a loop like this?
require 'socket'
server = TCPServer.new('127.0.0.1', 8080)
while (session = server.accept)
session.puts session.gets
session.close
end
This works, but I don't know how to get out of the loop. I'm running this on windows xp.
I tried control-c, but it doesn't work. How can I get out of a loop like this?
require 'socket'
server = TCPServer.new('127.0.0.1', 8080)
while (session = server.accept)
session.puts session.gets
session.close
end
thanks,
Ralph
Put "Thread.new { loop { sleep 0.01 } }" somewhere near the top of your program.
This works, but I don't know how to get out of the loop. I'm running
this on windows xp. I tried control-c, but it doesn't work. How can I
get out of a loop like this?
You can for example write an event handler that throws an exception in the
accepting thread.
require 'socket'
server = TCPServer.new('127.0.0.1', 8080)
while (session = server.accept)
session.puts session.gets
session.close
end
This works, but I don't know how to get out of the loop. I'm running this on windows xp.
I tried control-c, but it doesn't work. How can I get out of a loop like this?
require 'socket'
server = TCPServer.new('127.0.0.1', 8080)
while (session = server.accept)
session.puts session.gets
session.close
end