Berry-tan
Member
I'm writing an HTTP proxy server program. It's multi-threaded and the server part (where the local computer accepts a TCP connection and gets the server name and headers) works fine. It reads the headers, builds a new header, and sets it up to be sent. From there, all the proxy needs to do is forward data from the local computer going to the proxy to the remote server, and data coming from the remote server back going to the proxy to the local computer.
Basically, the data flow for the TCP redirector should look like this:
Unfortunately, that's where I'm stuck. There aren't any good examples or tutorials on how to handle asynchronous network streams. I'd like to have an object that triggers an event when data is received from a socket. Anyone have experience with the NetworkStream class?
Edit: I've attached the user class in a .ZIP file.
Basically, the data flow for the TCP redirector should look like this:
- Local computer → Proxy → Remote server
- Remote server ← Proxy ← Local computer
Unfortunately, that's where I'm stuck. There aren't any good examples or tutorials on how to handle asynchronous network streams. I'd like to have an object that triggers an event when data is received from a socket. Anyone have experience with the NetworkStream class?
Edit: I've attached the user class in a .ZIP file.
Attachments
Last edited: