I have a compressed file size of about 9.5 GB and want to transfer from one server to another server, I tried to use like the below,
我的压缩文件大小约为9.5 GB,并希望从一台服务器转移到另一台服务器,我尝试使用如下所示,
server2:
服务器2:
nc -lp 1234 > file.tar.gz
nc -lp 1234> file.tar.gz
server1:
server1的:
nc -w 1 1234 < file.tar.gz
nc -w 1 1234
its not working.
它不起作用。
I tried so many ways.
我尝试了很多方法。
One machine is CentOS 6.4 and the other one is Ubuntu 12.04 LTS
一台机器是CentOS 6.4,另一台是Ubuntu 12.04 LTS
Thanks in advance.
提前致谢。
3 个解决方案
#1
23
On receiving end:
收到结束时:
nc -l 1234 > file.tar.gz
On sending end:
发送结束时:
cat file.tar.gz | nc <reciever's ip or hostname> 1234
That should work. Depending on the speed, it may take a while but both processes will finish when the transfer is done.
这应该工作。根据速度,可能需要一段时间,但两个过程将在传输完成后完成。
#2
4
From the nc(1)
man page:
从nc(1)手册页:
-l
Used to specify that nc should listen for an incoming connection rather than initiate a connection to a remote host. It is an error to use this option in conjunction with the -p, -s, or -z options.-l用于指定nc应侦听传入连接,而不是启动与远程主机的连接。将此选项与-p,-s或-z选项一起使用是错误的。
So your use of -p
is wrong.
所以你使用-p是错误的。
Use on server2:
在server2上使用:
nc -l 1234 > file.tar.gz
And on server1:
在server1上:
nc server2 1234 < file.tar.gz
#3
0
from the sender
来自发件人
nc -v -w 30 1337 - l < filename
where "-v" from verbose, "-w 30" for a wait before and after 30 sec for the connection, "1337" port number, "-l" tell nc that this is a sender
其中“-v”来自详细,“-w 30”表示连接之前和之后等待30秒,“1337”端口号,“ - l”告诉nc这是发件人
from the receiver nc -v -w 2 ip_add_of_sender 1337 > filename
来自接收器nc -v -w 2 ip_add_of_sender 1337> filename
#1
23
On receiving end:
收到结束时:
nc -l 1234 > file.tar.gz
On sending end:
发送结束时:
cat file.tar.gz | nc <reciever's ip or hostname> 1234
That should work. Depending on the speed, it may take a while but both processes will finish when the transfer is done.
这应该工作。根据速度,可能需要一段时间,但两个过程将在传输完成后完成。
#2
4
From the nc(1)
man page:
从nc(1)手册页:
-l
Used to specify that nc should listen for an incoming connection rather than initiate a connection to a remote host. It is an error to use this option in conjunction with the -p, -s, or -z options.-l用于指定nc应侦听传入连接,而不是启动与远程主机的连接。将此选项与-p,-s或-z选项一起使用是错误的。
So your use of -p
is wrong.
所以你使用-p是错误的。
Use on server2:
在server2上使用:
nc -l 1234 > file.tar.gz
And on server1:
在server1上:
nc server2 1234 < file.tar.gz
#3
0
from the sender
来自发件人
nc -v -w 30 1337 - l < filename
where "-v" from verbose, "-w 30" for a wait before and after 30 sec for the connection, "1337" port number, "-l" tell nc that this is a sender
其中“-v”来自详细,“-w 30”表示连接之前和之后等待30秒,“1337”端口号,“ - l”告诉nc这是发件人
from the receiver nc -v -w 2 ip_add_of_sender 1337 > filename
来自接收器nc -v -w 2 ip_add_of_sender 1337> filename