We don’t allow questions seeking recommendations for software libraries, tutorials, tools, books, or other off-site resources. You can edit the question so it can be answered with facts and citations.
Closed 8 years ago.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(5)
那么你想要的在理论上是可能的。
有一些负担,例如命名虚拟主机、错误的列表端口和执行时间限制,但理论上您可以遵循规范并在 php 中完成所有操作。您可以打开套接字并向其中写入原始数据,因此理论上一切皆有可能。
但这是完全荒谬和毫无意义的。
但是您的问题并不新鲜,并且有解决方案。
它们被称为传播 CDN。
它们中的大多数提供边缘广播,用于以高速和低延迟交付内容(这是常见的用例),但您也可以使用它们来平衡流量。
Coruse 的大多数 CDN 都是要花钱的。
但有一个项目致力于解决这个非常具体的问题。缓存内容并将其传送到低带宽站点,并且仅从那里获取它。
它被称为coral cdn,你应该检查一下。最常用的商业应用可能是 akamai、cachefly 和 level3。
well what you want is theoretically possible.
there are some burdens like named virtual hosts and wrong listeing ports and execution time limits but you could theoretically follow the specs and do everything in php. you can open sockets and write raw data to it so theoretically anything is possible.
but its totally absurd and senseless.
however your problem is not new and there are solutions for that.
they are called propagating cdns.
most of them provide edgecasting for delivering content with high speed and low latency (this is the usual use case), but you can also use them to balance traffic.
most cdns of coruse cost money.
but there is a project devoted to this very specific problem. to cache content and deliver it for low bandwidth sites and only fetch it from there.
its called the coral cdn, you should check it out. the probably most used commercial ones are akamai, cachefly, and level3.
从长远来看,您必须为此拥有自己的服务器,因为您需要使用您的文件和种子在服务器上运行 torrent 客户端?然后就可以通过php访问了,又快又简单。我已经通过 Linux 服务器的 Transmission 完成了此操作。
In the long run you HAVE to have your own server for this, because you need to run a torrent client on your server with your file(s) and (a) seed(s)? Then you could access via php, it would be fast and easy. I have done this with Transmission for a Linux server.
我不认为这是 PHP 的工作。如果我正确理解您想要做什么,由于 PHP 脚本可以运行的时间限制,它根本无法在共享主机上工作。
任何需要超过允许的 30 或 60 秒的 torrent 上传或下载过程都必须跳转到下一页,重新连接,然后重新开始操作。我不明白这是如何运作的。
我认为在 PHP 中你能做的最好的事情就是将文件提供给负责播种的 torrent 站点。 Clearbits(SO 用于提供每月数据转储)可能是一项有用的服务(但它不是免费的) .)
I can't see this to be a job for PHP. If I understand what you want to do correctly, it will not work at all on shared hosting due to the time limit a PHP script can run in.
Any torrent upload or download process that takes longer than the allowed 30 or 60 seconds would have to jump to the next page, reconnect, and restart the action. I can't see how this could work.
I think the best you can do in PHP is serve a file to a torrent site that takes care of the seeding. Clearbits (used by SO to provide the montly data dump) might be a useful service for that (but it's not free.)
您可以超越 PHP 在 php.ini 文件中默认设置的时间限制。但是,如果您的主机看到此情况,他们可能会锁定您的帐户。如果您使用超过 3% 的计算机资源,大多数共享托管提供商将锁定您的帐户。尝试用 PHP 编写 Bittorent 客户端是荒谬的,除非您有专用的机器来运行它。
将其添加到您的配置文件或每个请求中包含的任何文件中。
请注意,您必须指定以秒为单位的时间,除非您执行以下操作
You can get past the time limit that PHP has set by default in the php.ini file. However if your hosts sees this they might lock your account. Most shared hosting providers will lock your account if you use more than say 3% of the machines resources. Trying to write a bittorent client in PHP is absurd unless you have a dedicated machine to run it upon.
add this to your configuration file or any file that is included on every request.
Note that you have to specify the time in seconds unless you do something like the following
可能我晚了几年,但你可以使用 Amazon S3 来实现这一点。
(不仅仅是典型的网络种子。)
请参阅此处的文档:
http://docs.aws.amazon.com/AmazonS3/latest/dev /S3Torrent.html
您只需将文件从共享服务器上传到 S3,然后分发 torrent 文件,并只需支付 S3 的传出带宽即可。
May be I'm years late but you can use Amazon S3 for this.
(Not just typical webseed.)
see document here:
http://docs.aws.amazon.com/AmazonS3/latest/dev/S3Torrent.html
You just upload files from shared server to S3 then distribute the torrent file and just paid for outgoing bandwidth from S3.