Way high-speed file transfer

A little bit of explanation

Sometimes, the need to transfer between computer and computer files, U disk sometimes inconvenient, U disk could not be read or come across the wonderful situation, a really pick one, then find a way.
With a computer in the LAN to pass, then the general speed limit can reach, good speed, according 100M router point of view, the speed is generally at 10MB / s or so.

LAN transmission ---- Dukto

Internet to find a good software ---- DuktoR6, though unhappy that the goods speed, speed test me here 3MB / s or so, but it can be used for most platforms, windows, linux, Android, ios, windows phone, windows 10 mobile / pc, covering most of daily use to the platform, and even windows phone windows 10 mobile have, had to be a conscience software.

Use is: two terminals (computer or mobile phone) in the same local area network, open DuktoR6, the software will automatically find other client under normal circumstances, as shown above, if not find it, then click on "IP connection", input accepts IP address of the client, does not know the IP address of the receiving end, then click on the receiving end of the middle of the bottom three icons icon, you know, if the receiving end also has multiple IP addresses, you have to find the sender with the same network IP address segment to obtain the job, the transmitting side view of the same approach with the IP address, to see the similarity of the first three parts of the IP address, in most cases, ordinary terminal IP address assigned by the router are of the form "192.168.1. X or 192.168.0.X.

After finding the receiving end, select a file or folder can be sent sent.

More high-speed approach

This method is applicable to a large volume of copies of the file, or even several tens G G copy of the document in this way, time is reduced significantly.

Most computers now come with Gigabit Ethernet, the theoretical transfer speeds can exceed 100MB / s, but is limited by the carrier bandwidth or router, speeds generally only a few MB / s, such as schools used the wing hearing, bandwidth 6M the maximum download speed is not to continue to download 1MB / s, performance of the card waste too much.

Two computers to transfer files, the use of two computers directly to the network cable connection, so bandwidth is theoretically able to reach the upper limit of the card.

Rationale

在上面所说的DuktoR6传输办法中,需要发送端和接收端都安装软件,有时候,这个反而不方便(比如两人都没有携带可以传输的设备,U盘什么的,别说手机了,有些手机不装驱动是没办法北电脑识别的)。

这里我使用的是最常见的直接通过链接下载的方法,也就是说通过TCP/IP协议,说得简单一点,就是拿浏览器直接下载了。

详细说明

安装nginx

如上面所说,想要通过浏览器直接下载对方电脑上的文件,得对方的电脑开启了web服务器,这个东西不难找,我使用的是nginx,点我下载
上面的下载链接是针对windows系统的,基于debian的系统使用下面的命令安装nginx

sudo apt-get install nginx

基于redhat的系统使用下面的命令安装nginx

sudo yum install nginx

下面以windows下的nginx使用方法为例

开启web服务器

使用命令提示符(在开始按钮上点击鼠标右键,选择命令提示符即可),然后切换到nginx所在的文件夹,我写本文时nginx版本为1.11.6,解压下载的压缩包,所得目录结构如下

│  nginx.exe
│  
├─conf
│      fastcgi.conf
│      fastcgi_params
│      koi-utf
│      koi-win
│      mime.types
│      nginx.conf
│      scgi_params
│      uwsgi_params
│      win-utf
│      
├─contrib
│  │  geo2nginx.pl
│  │  README
│  │  
│  ├─unicode2nginx
│  │      koi-utf
│  │      unicode-to-nginx.pl
│  │      win-utf
│  │      
│  └─vim
│      ├─ftdetect
│      │      nginx.vim
│      │      
│      ├─indent
│      │      nginx.vim
│      │      
│      └─syntax
│              nginx.vim
│              
├─docs
│      CHANGES
│      CHANGES.ru
│      LICENSE
│      OpenSSL.LICENSE
│      PCRE.LICENCE
│      README
│      zlib.LICENSE
│      
├─html
│      50x.html
│      index.html
│      
├─logs
└─temp

输入命令

start nginx

看到一个黑框一闪而过,这个时候nginx已经启动了,在浏览器地址栏输入localhost,即可看到这样的画面

我们同样可以在任务管理器查看进程

搭建静态文件服务器

这一步做完,我们就已经成功一大半了,搭建静态文件服务器的办法是更改conf文件夹下的nginx.conf文件。
不管用什么办法(我使用了记事本),编辑nginx.conf文件,将内容更改如下

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#user  nobody;
worker_processes 1;

#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;

#pid logs/nginx.pid;

events {
worker_connections 1024;
}

http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 80;
charset gbk;
server_name localhost;
client_max_body_size 4G;
root Directory_add;
location / {
autoindex on;
autoindex_exact_size off;
autoindex_localtime on;
}
}

}

自行更改Directory_ add为被传输文件的目录,比如我再D盘的download文件夹下的文件是我想要传输被对方的,Directory_add就改成D:Download
此时配置文件已经修改完成,使用命令

1
nginx -s reload

重载配置,使其生效,比如这里我改成F:Minecraft,重载配置文件后,浏览器打开localhost,界面是这样的:

这个时候,只要别人能打开这台电脑的IP,就可以直接点击相应的文件下载了。

开始传输

前面已经说过,原理便是搭建一个web静态文件服务器,这个时候,只要别人能连接打开服务器的电脑,便可以下载配置好的目录里面的文件了。

怎么连接呢?

第一种办法是仍然连接同一个局域网

第二种办法便是直接用网线连接两台电脑,没错,一根网线,两头都是电脑。
不过普通网线没办法使得两台电脑处于同一台局域网,要么使用交叉网线(这种网线一般用不到,所以不好找),要么参考这个办法的方法2的第四和第五个步骤

其实,绕来绕去,就是要让两台电脑能处于同一个网段下面,不管是连接同一个路由器还是用网线直连,目的都是这个。

PS的一些东西

在配置文件中,有这样一行

charset gbk;

因为我是在windows内进行的演示,不用gbk的话,遇到中文名的文件会乱码,如果是linux系统的话,需要删除这一行或者把gbk改成utf-8。

并且,nginx不能放在含中文的目录下面,Dectory_add也不能是含有中文或者空格的目录。

原文:大专栏  高速传输文件的办法


Guess you like

Origin www.cnblogs.com/petewell/p/11607363.html