简体   繁体   English

通过互联网传输p2p文件

[英]p2p file transfer over internet

I know there are several similar questions out there such as this one. 我知道有几个类似的问题在那里,如一个。 I need to set up a connection between two computers and be able to send a large file. 我需要在两台计算机之间建立连接并能够发送大文件。 Let me explain the problems that I encountered when reading similar posts: 让我解释一下阅读类似文章时遇到的问题:

1) lots of them talked about tcp connections. 1)他们中很多人都在谈论tcp连接。 I was able to send data but most of the time I was not able to send large amounts of data. 我能够发送数据,但是大多数时候我无法发送大量数据。

2) most of the examples where created in local networks. 2)大多数示例是在本地网络中创建的。 I was able to send data over two different networks over the internet with the tcp examples but I had to open ports on the router and forward them to the computer that I wanted to communicate to. 我能够使用tcp示例通过Internet在两个不同的网络上发送数据,但是我必须打开路由器上的端口,并将其转发到要与之通信的计算机。

3) Libraries such as monotorrent or bitsharp where hard to find and I did not find good examples. 3)诸如monotorrent或bitsharp之类的图书馆很难找到,我找不到很好的例子。 I where not able to make them work. 我无法使他们工作。

so in short I just need to send files from one computer to another computer over the internet and I don't want to open ports on the router nor do any kind of port forwarding. 简而言之,我只需要通过Internet将文件从一台计算机发送到另一台计算机,并且我不想打开路由器上的端口,也不需要任何类型的端口转发。 people do not have to open ports on their routers when using limewire for example and they are downloading files from someone else computer. 例如,当使用limewire时,人们不必在路由器上打开端口,而从其他人的计算机上下载文件。 It will be nice if someone can provide me with a short example of how to set up the server and how to send a file to the server with the client code. 如果有人可以向我提供有关如何设置服务器以及如何使用客户端代码将文件发送到服务器的简短示例,那将是很好的。

The port opening and forwarding problem that you mention is a very real one, and there is no easy work around. 您提到的端口打开和转发问题是一个非常现实的问题,没有容易解决的方法。 Applications like uTorrent use UPnP port mapping and / or NAT-PMP to talk to your router automatically and get it to do the relevant port-mappings "on the fly". 像uTorrent这样的应用程序使用UPnP端口映射和/或NAT-PMP来自动与您的路由器通信,并使其“实时”进行相关的端口映射。 Not all routers implement these protocols (and in many cases, users might disallow their use for security reasons), so the web is littered with questions on how to do port forwarding for limewire, uTorrent, etc. 并非所有路由器都实现这些协议(并且在很多情况下,出于安全原因,用户可能会禁止使用它们),因此,网络上到处都是关于如何为limewire,uTorrent等进行端口转发的问题。

Other than reading up on this, I would recommend that you specify your questions in a bit more detail, eg: 除了继续阅读之外,我建议您更详细地说明您的问题,例如:

I was able to send data but most of the time I was not able to send large amounts of data. 我能够发送数据,但是大多数时候我无法发送大量数据。

this is a bit too vague for us to guess at what the problem is. 对于我们来说,这太模糊了,无法猜测问题出在哪里。 What size file were you sending, over what connection, did you get errors, or was it just slow, etc? 您要发送什么大小的文件,通过什么连接发送,是否收到错误消息,或者只是速度慢等?

Binfer does exactly what you are trying to do except that it is closed source and commercial. Binfer完全是您要尝试做的事情,除了它是封闭源代码和商业用途的。 I dont think that is is trivial to do something like that, hence you probably wont find any examples to do that. 我认为这样做不是一件容易的事,因此您可能找不到任何示例来做到这一点。 A long time ago, I dabbled with JXTA, which promised a lot but delivered too little. 很久以前,我涉足JXTA,它承诺了很多,但交付的却很少。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM