Ruby: writing a network redirector
- by Shyam
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!