Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/delphi/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/sockets/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/three.js/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在delphi中侦听和重新映射tcp连接?_Delphi_Sockets_Tcp_Dns_Delphi Xe3 - Fatal编程技术网

如何在delphi中侦听和重新映射tcp连接?

如何在delphi中侦听和重新映射tcp连接?,delphi,sockets,tcp,dns,delphi-xe3,Delphi,Sockets,Tcp,Dns,Delphi Xe3,我有一个TCP连接(代理),通过socks4-5连接,并通过它发送http/https/DNS流量。 我需要一些东西来共享,一些东西到http/https等通过tcp连接1和dns解析通过tcp连接2 我试图创建IdTCPServer1(但我不确定是否正确),它可以连接,但没有任何东西发送给他。 此外,他将一直挂起,直到ReadLn它将不会被记录数据,这是不允许的 procedure TForm1.IdTCPServer1Execute(AContext: TIdContext); var s

我有一个TCP连接(代理),通过socks4-5连接,并通过它发送http/https/DNS流量。 我需要一些东西来共享,一些东西到http/https等通过tcp连接1和dns解析通过tcp连接2

我试图创建IdTCPServer1(但我不确定是否正确),它可以连接,但没有任何东西发送给他。 此外,他将一直挂起,直到ReadLn它将不会被记录数据,这是不允许的

procedure TForm1.IdTCPServer1Execute(AContext: TIdContext);
var str_str:String;
begin
  str_str:=AContext.Connection.Socket.ReadLn();
  if(str_str<>'') then    Memo1.Lines.Add('#TCP_SERVER: EXECUTE: '+str_str);
过程TForm1.IdTCPServer1Execute(AContext:TIdContext);
var str_str:String;
开始
str_str:=AContext.Connection.Socket.ReadLn();
如果是(str#u str“”),则Memo1.Lines.Add('#TCP#u SERVER:EXECUTE:'+str#u str);

您需要处理(实现)socks4/5服务器端协议(请参阅)。在请求中,您可以截取到端口号,查看它是http、dns还是其他。然后根据它转发连接。

请参阅@mjn,它很有帮助!冻结解决了这个问题!非常感谢你!Indy有一个
TIdSocksServer
组件。这个标准没有一个关于dns的词,感觉它不受支持!DNS请求中的开始字节:#05#F0。。。05-版本套接字,F0-dns请求,但wikipedia和rfc1928没有描述此请求,wiki说:0x01=建立TCP/IP流连接0x02=建立TCP/IP端口绑定0x03=关联UDP端口,但0xF0没有这样的请求