C# Proxy Server: how to send/receive data with sockets? -


i'm trying create simple proxy server in c#. below portion of code created socket host name parsed browser http request. full request in string "header" , sent destination socket. while loop receives response socket , sends client socket.

socket destserversocket = new socket(addressfamily.internetwork, sockettype.stream, protocoltype.tcp); destserversocket.connect(host, 80); destserversocket.send(asciiencoding.ascii.getbytes(header)); byte[] response = new byte[1];   while (destserversocket.receive(response) != 0) {     client.send(response); }  destserversocket.disconnect(false); destserversocket.dispose(); client.disconnect(false); client.dispose(); 

right proxy works simple html sites. else , endlessly loads without ever displaying content in browser. how alter code allow proxy server work on websites more complex basic html ones?


Comments

Popular posts from this blog

javascript - How to bind ViewModel Store to View? -

dll - AutoIt (AutoItX) on C# Windows 7 App System.DllNotFoundException -

python - Alternative to referencing variable before assignment -