duanbi5906 2015-02-17 19:05
浏览 98
已采纳

Socks5多个请求

i'm using a socks5 php library that connects to a proxy and sends data through it. The library works when i do a single request to a http server, but when i do the second in receive empty string and at the third i receive an error

10053 An established connection was aborted by the software in your host machine.

I don't understand why that happens, i looked trought RFC and wikipedia about the socks5 server and i think all the connection is correct. But still don't get second response.

The library code is one file and i get it from here Socks5Socket

And my code is the next one

set_time_limit(100);
error_reporting ( E_ALL );

require_once "Socks5Socket.php";

$s = new \Socks5Socket\Client();
$s->configureProxy(array(
    'hostname' => '162.144.56.44',
    'port' => 60088
));
$s->connect('en.wikipedia.org', 80);
$request = "GET /wiki/HTTP_persistent_connection HTTP/1.1
".
           "Host: en.wikipedia.org
Connection: Keep-Alive

";
$s->send($request);
$response = $s->readAll();

//At this point all OK



$request2 = "GET /wiki/No-till_farming HTTP/1.1
".
           "Host: en.wikipedia.org
Connection: Keep-Alive

";

$s->send($request2);
// Empty string here, no error
$response2 = $s->readAll();


$s->send($request2);
// Errno 10053
$response3 = $s->readAll();
file_put_contents("response.txt",$response2);
$response = substr($response,strpos($response,"»")+1);
//echo $response;
echo "<br><br>".substr($response,strpos($response,"

")+1);
  • 写回答

1条回答 默认 最新

  • doutan5844 2015-02-18 09:00
    关注

    Ok, the problem was that the http server was closing my connection before i could do anything else. I've tried with a SMTP server and the connection was no more closed.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog