My question is when you have a proxy server and you need to send/recv with client and send/recv with remote server how do you know at what end there is data to be send/recv so I can call the appropriate functions.
I need to recv/send bytes from a website to a client(via proxy) and from client to server (via proxy), but I don't know in what order they are coming,I saw that is different for most sites.
My current implementation is this:
1) receive from client
2) send to server
//infinite loop here
3) receive from server
4) send to client
// until bytes from server is 0
This just works for a few sites,and doesn't load them completely, only 15-20 KB.
Any suggestions?