Ruby: writing a network redirector

Posted by Shyam on Stack Overflow See other posts from Stack Overflow or by Shyam
Published on 2010-04-16T02:03:00Z Indexed on 2010/04/16 2:13 UTC
Read the original article Hit count: 343

Hi,

I would like to research protocols such as HTTP. As I am learning Ruby, I would like to write a program that works as a "gateway". I would be connecting to it's port on for example 8080 and the program should forward my request to the real host and send back the answers. The idea of my design is something like this:

class EchoProxy

def run
  # run a listening socket on port 8080 
  myinfiniteloop
end

def myinfiniteloop
  # continually run this loop unless the app is terminated
  puts traffic
end

end

Some pointers in the right direction would be great! Thank you for your comments, answers and feedback!

© Stack Overflow or respective owner

Related posts about ruby

Related posts about network-programming