查询DHT服务器

编程入门 行业动态 更新时间:2024-10-26 00:28:00
本文介绍了查询DHT服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在尝试对DHT服务器进行简单的查询.

I'm trying to make a simple query to a DHT server.

我正在尝试制作一个简单的示例来测试对服务器的查询,但是我没有从服务器获得任何形式的响应...

I'm trying to make a simple simple example to test queries to the servers, but I don't get a response from the server in any form...

小例子:

$socket = fsockopen("udp://router.bittorrent", 6881, $errno, $errstr, 3); fwrite($socket, 'p'); $Head = fread($socket, 4); $CheckStatus = socket_get_status($socket); if($CheckStatus["unread_bytes"] == 0) { return 0; } $do = 1; while($do) { $str = fread($socket,1); $stats .= $str; $status = socket_get_status($socket); if($status["unread_bytes"] == 0) { $do = 0; } } fclose($socket);

有关DHT服务器中查询的信息,请点击此处: www .bittorrent/beps/bep_0005.html#dht-queries

The info about the queries in DHT server is here: www.bittorrent/beps/bep_0005.html#dht-queries

但是我不明白如何用PHP做到这一点. 这可能吗?我的代码有什么问题?

But I don't understand how make this with PHP. Is this possible? What's the problem with my code?

推荐答案

如8472所述,您的客户端正在发送p,这不是有效的查询.要查看有效的查询格式,请点击此处: bep 005

As the8472 mentions, your client is sending p, which is not a valid query. To see valid query formats, look here: bep 005

更多推荐

查询DHT服务器

本文发布于:2023-10-24 13:28:30,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1524077.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:服务器   DHT

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!