
2011/10/18 Jason Dusek
2011/10/18 Ertugrul Soeylemez
: A proxy server acts a lot like an echo server. The difference is that usually before the actual proxying starts you have a negotiation phase, and instead of echoing back to the same socket, you just write it to a different one. Here is an (untested) example:
(clientH, clientHost, clientPort) <- accept serverSock destH <- negotiate clientH doneVar <- newEmptyMVar
forkIO (hGetContents clientH >>= hPutStr destH >>= putMVar doneVar) forkIO (hGetContents destH >>= hPutStr clientH >>= putMVar doneVar) replicateM_ 2 (takeMVar doneVar) mapM_ hClose [clientH, destH]
This code seems like it says: [...]
After working through Gregory Collins suggestion, above, I see that I was not reading your code correctly. -- Jason Dusek () ascii ribbon campaign - against html e-mail /\ www.asciiribbon.org - against proprietary attachments