Login
Home About

Udo's Techblog

The Coolness of Ruby Knows No Bounds
Date: 2007-04-05 10:08:51

You probably knew that already. But check out how easy it is to write a multithreaded TCP server in Ruby:
socket = TCPServer.new(listenIp,listenPort)
socket.setsockopt(Socket::IPPROTO_TCP,
Socket::TCP_NODELAY, true)
begin
while
session = socket.accept
thisThread = Thread.new(session) {|thisSession|
while thisSession
# do your server i/o stuff
end
}
end
end


Mwahahahaha...

Comments

Name
Email
URL(optional)
Text
Page time: 0.918 seconds.