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

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.

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

报告相同问题?

悬赏问题

  • ¥50 uniapp小程序页面录制可回溯
  • ¥15 求Houdini使用行家,付费。价格面议。
  • ¥15 AttributeError: 'EasyDict' object has no attribute 'BACKUP_DB_INFO'
  • ¥15 前端高拍仪调用问题报错
  • ¥15 想用octave解决这个数学问题
  • ¥15 Centos新建的临时ip无法上网,如何解决?
  • ¥15 海康威视如何实现客户端软件对设备语音请求的处理。
  • ¥15 支付宝h5参数如何实现跳转
  • ¥15 MATLAB代码补全插值
  • ¥15 Typegoose 中如何使用 arrayFilters 筛选并更新深度嵌套的子文档数组信息