简体   繁体   中英

C/C++ SOCKET Proxy

Currently, I implemented a client and server application which use simple SOCKETs to communicate with each other. Like this .

The problem is that some users don't have a direct access to the internet, so they use proxys.

How can I use SOCKETs for a communication over a proxy (eg default IE proxy), or is there any other possibility?

First and foremost, there are different types of proxies and different types of protocols used by those proxies. There are HTTP proxies, SOCKS proxies, Tunneling proxies, etc. So first you need to decide what type(s) of proxies you want to support in your code, and then implement each of those protocols as needed.

In general, instead of connect() 'ing directly to the desired server, the client would connect() to a proxy server instead and instruct it to connect to the server, using whatever protocol that proxy uses. Once that connection has been established, the rest of the client and server code would send() and recv() data normally as it already is, and the proxy would transparently exchange the data back and forth.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM