0

I am trying to create a proxy for UDP in python. Here's the scenario:

Client connects to server on port 6000 from a high random port (say 53273) Server reply to port 53273 from port 55385

Then the communication continue over these two ports.

These 2 port number are only known when the communication is initiated.

The proxy should log all messages in both direction to a text file.

Thank you

GIFRATE
  • 1
  • 1
  • Right. I am looking mainly for pointers to start. I looked at twisted but I don't think calling the reactor.run() 3 times would work. – GIFRATE Feb 09 '11 at 22:21
  • 1
    That's not how twisted works, you can certainly open many ports with it. – Jochen Ritzel Feb 11 '11 at 22:34
  • Twisted is great for such proxies. See this question: http://stackoverflow.com/questions/2269380/how-do-i-get-my-simple-twisted-proxy-to-work – ypercubeᵀᴹ May 14 '11 at 07:49

1 Answers1

0

I would start with this:

http://docs.python.org/library/socketserver.html#asynchronous-mixins

This is a threaded socket server built into python. You can use it to serve up the main port and then call a handler whenever a client connects. You'll need it to be threaded since it sounds like your running some type of chatroom with logging.

whitey04
  • 1,321
  • 11
  • 17