用winsock编程时,怎样才能时程序通过代理访问internet?最好给小段代码。。

解决方案 »

  1.   

    穿透代理服务器编程 http://www.allfresh.net/program/proxy.htm
      

  2.   

    如下:sock4连接过程
    // 1.连接Proxy Server
    // 2.向Proxy Server发送连接命令,命令的内容如下:
    // char chVer; //版本=4
    // char chComd; //命令=1,代表connect
    // u_short nPort; //服务器端口
    // u_long lIP; //服务器IP地址,如果非实际IP地址,这个地方可以填写0.0.0.x,然后在填写szIP[]
    // char szUserName[] //如果需要,验证的用户名地址
    // [char szIP[]] //在使用域名连接时的域名地址
    // 3.等待Proxy Server的应答消息,消息内容如下:
    // char chVer; //版本=0
    // char chResult; //结果
    // //90: request granted
    // //91: request rejected or failed
    // //92: request rejected becasue SOCKS server cannot connect to identd on the client
    // //93: request rejected because the client program and identd report different user-ids
    // unsigned short nPort;
    // unsigned long lIP;