kan var isa:SOCKADDR_IN; isa_len:integer;//接受客户端的套接字。 acceptsocket:Tsocket //主机 targethost:pchar//端口 begin client:=socket(pf_inet,sock_stream,ipproto_ip); if client+invalid_socket then //showerror end; ca.sin_family:=pf_inet;//ip zu ca.sin_port=htons(targetprot);//转换网络字节 hostadd:=inet_addr(targethost); if (hostaddr=-1) then //showerror end; 太多了。。看能不能帮你
其他TCP的,例如FTP,POP的,就需要HTTP Tunnel代理
需要自己开发实现的QQ用的是HTTP Tunnel_____________________
http://lysoft.7u7.net
var
isa:SOCKADDR_IN;
isa_len:integer;//接受客户端的套接字。
acceptsocket:Tsocket //主机
targethost:pchar//端口
begin
client:=socket(pf_inet,sock_stream,ipproto_ip);
if client+invalid_socket then
//showerror
end;
ca.sin_family:=pf_inet;//ip zu
ca.sin_port=htons(targetprot);//转换网络字节
hostadd:=inet_addr(targethost);
if (hostaddr=-1) then
//showerror
end;
太多了。。看能不能帮你
源码就不贴了。你自己看吧。
http://www.codeguru.com/Cpp/I-N/internet/http/print.php/c6209/个人经验:
用TIdTCPClient实现非常容易,直接用它的WriteLn函数发送字符串,接收就用ReadLn。
用TClientSocket实现,请先将它设置为阻塞模式,然后用SendText函数发送字符串时要自己在字符串结尾加上#13#10,接收就用ReceiveText。