> Arrays of _what_ do you think? Maybe array's of sockets? Actually > array's of any instance of IO. Yes you have been right, also if this looks terrible now because: myselec = IO.select([server]) fills myselec with [[socket]] so with 2 Arrays I have to extract with myselec[0][0]...somehow perl looks more intuitive in this case. Thats the perl code I wanna translate to ruby: http://mailman.linuxchix.org/pipermail/techtalk/2003-January/014338.html and this is my ruby code: #!/usr/bin/env ruby $Verbose=true require 'socket' require 'uri' require 'io/wait' $bind_port = '2222' $bind_address='localhost' # opens a socket on the local machine and binds the proxy to it proxy = Socket.new(Socket::AF_INET, Socket::SOCK_STREAM, 0) proxy.bind(Socket.pack_sockaddr_in($bind_port, $bind_address )) proxy.listen( 5 ) # waits for Browser-client to connect while client = proxy.accept fork() # read what comes from the Browser into request request='' while client[0].readline request += $_ break if $_ =~ /^\s*$/m if $_ =~ /^GET .+/ host = URI.parse(URI.extract($_)[0]).host port = URI.parse(URI.extract($_)[0]).port end end # connect to remote webserver and sends the request and read the response server = Socket.new(Socket::AF_INET, Socket::SOCK_STREAM, 0) server.connect(Socket.pack_sockaddr_in(port, host.chomp.sub('/','') )) server.write(request) response='' while server.readline response += $_ break if $_ =~ /^\s*$/m end # sends the http-header to browser client[0].write(response) # listens for further responses of the server and sends it to the browser myselec = IO.select([server]) while myselec[0][0].ready? response = server.read(2**16) break if !response client[0].write(response) end end This works a bit now for calling just one url in the browser but problem at the moment is just the handling of the different child processes. I can't close client with client.close because it's an array and no socket-handler?!? So I'm struggeling with translating this to ruby: -- kazaam <kazaam / oleco.net>