WO2017166522A1 - 终端设备间传输文件的方法、终端设备及文件传输系统 - Google Patents

终端设备间传输文件的方法、终端设备及文件传输系统 Download PDF

Info

Publication number
WO2017166522A1
WO2017166522A1 PCT/CN2016/089449 CN2016089449W WO2017166522A1 WO 2017166522 A1 WO2017166522 A1 WO 2017166522A1 CN 2016089449 W CN2016089449 W CN 2016089449W WO 2017166522 A1 WO2017166522 A1 WO 2017166522A1
Authority
WO
WIPO (PCT)
Prior art keywords
terminal device
destination terminal
file
server
transmission link
Prior art date
Application number
PCT/CN2016/089449
Other languages
English (en)
French (fr)
Inventor
张仕奇
Original Assignee
乐视控股(北京)有限公司
乐视网信息技术(北京)股份有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 乐视控股(北京)有限公司, 乐视网信息技术(北京)股份有限公司 filed Critical 乐视控股(北京)有限公司
Publication of WO2017166522A1 publication Critical patent/WO2017166522A1/zh

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/06Protocols specially adapted for file transfer, e.g. file transfer protocol [FTP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L65/00Network arrangements, protocols or services for supporting real-time applications in data packet communication
    • H04L65/40Support for services or applications
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/104Peer-to-peer [P2P] networks

Definitions

  • the present invention relates to the field of data transmission technologies, and in particular, to a method, a terminal device, and a file transmission system for transferring files between terminal devices.
  • Bluetooth transmission means that two smartphones directly connect to Bluetooth and then transmit wirelessly via Bluetooth, but Bluetooth transmission only allows point-to-point transmission, and the connection distance allowed by Bluetooth is also very short, only a few tens of meters, which is very inconvenient.
  • the computer relay transmission means that the source smart phone first connects to the computer through the data line, uploads the file to be transmitted to the computer, and then the source smart phone is disconnected from the computer, and then the destination smart phone is connected to the computer through the data line, and then downloaded from the computer.
  • the file to be transferred, the computer transfer is also very troublesome, and is limited by the data line. Therefore, in the prior art, it is very inconvenient to transfer files between smartphones.
  • the technical problem to be solved by the present invention is to provide a method for transmitting files between terminal devices, a terminal device, and a file transmission system.
  • the transmission is mainly performed through a network, which facilitates transmission between smartphones to be transmitted.
  • the terminal device can intelligently select the transmission network when transmitting the file to be transmitted, and improve the transmission speed of the file to be transmitted.
  • a technical solution adopted by the present invention is to provide a method for transmitting a file between terminal devices, including: establishing a first transmission link with a server; and when transmitting a file to be transmitted to a destination terminal device Searching for the presence of the destination terminal device in the local area network in which it is located; if the destination terminal device is present, establishing a second transmission with the destination terminal device Transmitting, by the second transmission link, the file to be transmitted to the destination terminal device; if the destination terminal device is not present, sending the to-before to the server by using the first transmission link And transmitting the file, so that the server forwards the file to be transmitted to the destination terminal device by using a third transmission link established between the server and the destination terminal device.
  • the step of transmitting the file includes: transmitting, by the first transmission link, a file transmission request message to the server, where the file transmission request message carries an identifier of the destination terminal device; and receiving the returned by the server a file transfer permission message, wherein the file transfer permission message is a message returned by the server when the server finds a third transmission link with the destination terminal device according to the file transfer request; according to the file Transmitting a permission message, the sending, by the first transmission link, the file to be transmitted to the server, so that the server forwards the file to be transmitted to the destination terminal device.
  • the step of searching for the presence of the destination terminal device in the local area network in which the user is located includes: broadcasting a search message to the local area network where the user is located, wherein the search message carries the destination terminal device Identifying, after receiving the response message returned by the destination terminal device according to the search message, determining that the destination terminal device exists in the local area network where the terminal device is located, and if the destination terminal device does not receive the response returned by the destination terminal device The message determines that the destination terminal device does not exist in the local area network.
  • the response message carries an IP address and a port of the destination terminal device; the first transmission link, the second transmission link, and the third transmission link are both TCP links.
  • the method further includes: sending a registration message to the server; receiving a successful registration returned by the server after successfully registering according to the registration message Message.
  • a terminal device including a first establishing module, configured to establish a first transmission link with a server, and a search module.
  • the second establishing module is configured to establish and when the search module searches for the destination terminal device a second transmission link between the destination terminal devices;
  • a first transmission module configured to send the file to be transmitted to the destination terminal device by using the second transmission link;
  • a second transmission module configured to be used
  • the search module does not search for the destination terminal device
  • the file to be transmitted is sent to the server through the first transmission link, so that the server passes the third transmission chain established between the server and the destination terminal device.
  • the road forwards the file to be transmitted to the destination terminal device.
  • the second transmission module includes: a first sending unit, configured to send, by using the first transmission link, a file transmission request message to the server, where the file transmission request message carries the destination terminal And a receiving unit, configured to receive a file transfer permission message returned by the server, where the file transfer permission message is that the server finds that the server and the destination terminal device are established according to the file transfer request. a packet that is returned when the third transmission link is used; and a second sending unit is configured to send, according to the file transmission permission message, the file to be transmitted to the server by using the first transmission link, so that The server forwards the file to be transmitted to the destination terminal device.
  • the search module includes: a broadcast unit, configured to broadcast a search message to the local area network where the search unit is located, where the search message carries an identifier of the destination terminal device; and a determining unit is configured to receive The destination terminal device determines, according to the response message returned by the search packet, that the destination terminal device exists in the local area network, and if the response message returned by the destination terminal device is not received, The destination terminal device does not exist in the local area network where the user is located.
  • the response message carries an IP address and a port of the destination terminal device; the first transmission link, the second transmission link, and the third transmission link are both TCP links.
  • a file transmission system including a server, a source terminal device, and a destination terminal device, wherein the source terminal device and the server establish a first transmission link.
  • the destination terminal device and the server are configured with a third transmission link, and the source terminal device is configured to search for the destination terminal device in the local area network where the file is to be transmitted when the file to be transmitted is sent to the destination terminal device.
  • the source terminal device and the destination terminal device of the present invention respectively establish a first transmission link and a third transmission link with the server, and when the source terminal device transmits to the destination terminal device
  • the source terminal device first determines whether the destination terminal device is located in the local area network where the source terminal device is located. If yes, the second transmission link is directly established between the source terminal device and the destination terminal device, and the source terminal device passes the second transmission.
  • the link transmits the file to be transmitted to the destination terminal device, and the source terminal device and the destination terminal device are located in the same local area network.
  • the transmission speed is faster, thereby improving the transmission of the file to be transmitted between the terminal devices. Transmission speed.
  • the source terminal device forwards the file to be transmitted to the destination terminal device through the server, and ensures that the file to be transmitted successfully reaches the destination terminal device.
  • Figure 1 is a schematic illustration of an embodiment of a file transfer system of the present invention
  • FIG. 2 is a schematic diagram of an embodiment of a terminal device of the present invention.
  • FIG. 3 is a schematic diagram of another embodiment of a terminal device of the present invention.
  • FIG. 4 is a flowchart of a method for transmitting a file between terminal devices according to the present invention.
  • FIG. 5 is a flowchart of a method for determining a method for transmitting a file between terminal devices according to the present invention to determine whether a terminal device and a destination terminal device are located in the same local area network;
  • FIG. 6 is a flowchart of forwarding a file to be transmitted to a destination terminal device by a server in a method for transmitting a file between terminal devices according to the present invention.
  • the file transfer system 20 includes a server 21, a source terminal device 22, and a destination terminal device 23.
  • the source terminal device 22 establishes a first transmission link with the server 21, and the destination terminal device 23 establishes a third transmission link with the server 21.
  • the source terminal device 22 and the destination terminal device 23 may be a personal computer, a smart phone, a PDA or a tablet, or the like.
  • the source terminal device 22 is configured to search for a destination terminal device 23 in the local area network where the file to be transmitted is sent to the destination terminal device 23, and if there is a destination terminal device 23, establish a relationship with the destination terminal device 23.
  • the second transmission link sends the file to be transmitted to the destination terminal device 23 through the second transmission link. If the destination terminal device 23 does not exist, the file to be transmitted is sent to the server 21 through the first transmission link, so that the server 21 passes The third transmission link forwards the file to be transmitted to the destination terminal device 23.
  • the transmission speed of the file to be transmitted on the local area network is usually faster than that in the wide area network.
  • the second transmission link between the source terminal device 22 and the destination terminal device 23 is directly established, and then the file to be transmitted is transmitted through the second transmission link, which greatly improves the file.
  • the transfer speed of the file to be transferred is forwarded by the server 21 to ensure that the file to be transmitted successfully reaches the destination terminal device 23.
  • the server 21 determines whether it is the third transmission link with the destination terminal device 23, and if so, returns a file transfer permission message, and if not, re-establishes the destination terminal device.
  • the third transmission link between 23 returns a file transmission permission message after successful establishment, otherwise it does not allow transmission of file information.
  • the file to be transmitted is sent to the server 21 through the first transmission link according to the file transmission permission message, so that the server 21 forwards the file to be transmitted to the destination terminal device 23.
  • the file to be transmitted also carries the identifier of the destination terminal device 23, so that the server 21 knows which terminal device to forward after receiving the file to be transmitted.
  • the identifier of the destination terminal device 23 is preferably the IP address and port of the destination terminal device 23.
  • the source terminal device 22 searches for the presence of the destination terminal device 23 in the local area network where the source terminal device 22 is located.
  • the destination terminal device 23 broadcasts the search packet to the local area network where the destination terminal device 23 is located.
  • the search message carries the identifier of the destination terminal device 23.
  • the terminal device in the local area network determines whether the identifier carried in the search packet is the same as the identifier of the search packet. If the identifier is the same, the response packet is returned. If not, the terminal device does not process the response packet.
  • the source terminal device 22 determines that the destination terminal device 23 exists in the local area network where the own terminal device 23 is located.
  • the destination terminal device 23 determines whether there is a destination terminal device 23 in the local area network by using the foregoing manner.
  • the source terminal device 22 broadcasts another search message, and the terminal device in the local area network receives another When searching for a message, it returns its own identity, and the source terminal device 22 determines whether the destination terminal device 23 exists in the local area network according to the returned identifier.
  • the function of the source terminal device 22 to search for other terminal devices in the local area network is directly registered as a service when the source terminal device 22 is started, for example, an NSD local area network discovery service, and the source terminal device 22 needs to send the destination terminal device 23 to the destination terminal device 23.
  • the source terminal device 22 searches for the destination terminal device 23 in the local area network where the NSB local area network discovery service is located.
  • the NSD local area network discovery service is also registered.
  • the terminal device of the local area network starts the NSD local area network discovery service at the time of startup, and can also start the link establishment service, and the link establishment service is used to establish a transmission link between the terminal device and the server 21.
  • the first transmission link, the second transmission link, and the third transmission link are both TCP links.
  • the source terminal device 22 and the destination terminal device 23 establish a transmission link with the server 21 at the time of startup, it is necessary to register with the server 21 first, and the source terminal device 22 transmits a registration message to the server 21.
  • the registration message carries information about the source terminal device 22, such as the MAC address of the source terminal device 22, the IMEI sequence number, and the like.
  • the registration message can also be encrypted. For example, the MAC and IMEI serial numbers are spliced together and base64 encryption is performed, and the encrypted data is sent to the server 21 for registration.
  • the server 21 After the registration is successful, the server 21 returns a successful registration message, and the successful registration message may carry the device ID assigned by the server 21 to the source terminal device 22, wherein the device ID may be unique.
  • the device ID can also be used as the identity of the source terminal device 22.
  • the source terminal device 22 receives the successfully registered message.
  • the source terminal device and the destination terminal device respectively establish a first transmission link and a third transmission link with the server.
  • the source terminal device transmits the file to be transmitted to the destination terminal device
  • the source terminal device first determines the purpose. Whether the terminal device is located in the local area network where the source terminal device is located, if yes, the second transmission link is directly established between the source terminal device and the destination terminal device, and the source terminal device transmits the file to be transmitted to the destination terminal device through the second transmission link.
  • the source terminal device and the destination terminal device are located on the same local area network, and the transmission speed of the file to be transmitted is increased.
  • the source terminal device forwards the file to be transmitted to the destination terminal device through the server, and ensures that the file to be transmitted successfully reaches the destination terminal device.
  • the invention further provides an implementation of a terminal device.
  • the terminal device 30 includes a first establishing module 301, a searching module 302, a second establishing module 303, a first transmitting module 304, and a second transmitting module 305.
  • the first establishing module 301 is configured to establish a first transmission link with the server.
  • the searching module 302 is configured to search for a destination terminal device in a local area network where the file to be transmitted is sent when the file to be transmitted is sent to the destination terminal device.
  • the second establishing module 303 is configured to establish a second transmission link with the destination terminal device when the search module 302 searches for the destination terminal device.
  • the first transmission module 304 is configured to send the file to be transmitted to the destination terminal device by using the second transmission link.
  • the second transmission module 305 is configured to send, to the server, the to-be-transmitted transmission through the first transmission link when the search module 302 does not search for the destination terminal device. And a file, so that the server forwards the file to be transmitted to the destination terminal device by using a third transmission link established between the server and the destination terminal device.
  • the speed at which the file to be transmitted is transmitted in the local area network is faster than that in the wide area network. Therefore, when the source terminal device and the destination terminal device are located in the same local area network, the source terminal device and the destination terminal device directly establish a second relationship. The transmission link is transmitted, which can greatly improve the transmission speed of the file to be transmitted.
  • the server forwards the packet to ensure that the file to be transmitted successfully reaches the destination terminal device.
  • the server may be first asked whether to establish a second transmission link with the destination terminal device.
  • the second transmission module 305 includes a first sending unit 3051 and a receiving unit 3052. And a second transmitting unit 3053.
  • the first sending unit 3051 is configured to send a file transmission request message to the server by using the first transmission link, where the file transmission request message carries the identifier of the destination terminal device.
  • the receiving unit 3052 is configured to receive a file transfer permission message returned by the server, where the file transfer permission message is a message returned by the server when the server and the destination terminal device establish a third transmission link according to the file transfer request.
  • the second sending unit 3053 is configured to send the file to be transmitted to the server by using the first transmission link according to the file transmission permission message, so that the server forwards the file to be transmitted to the destination terminal device.
  • the terminal device can be implemented by broadcasting a search message when the terminal device of the search destination is in the same local area network.
  • the search module 302 includes a broadcast unit 3021 and a determining unit 3022.
  • the broadcast unit 3021 is configured to broadcast a search message to the local area network where the search unit is located, where the search message carries the identifier of the destination terminal device.
  • the determining unit 3022 is configured to: after receiving the response message returned by the destination terminal device according to the search message, determine that the destination terminal device exists in the local area network where the terminal device is located, and if the response message returned by the destination terminal device is not received, determine The destination terminal device does not exist in the local area network where it is located.
  • the response message carries an IP address and a port of the destination terminal device; the first transmission link, the second transmission link, and the third transmission link are both TCP links.
  • the terminal device When the terminal device forwards the file to be transmitted through the server, it needs to be registered as a member of the server.
  • the terminal device further includes a sending module (not shown) and a receiving module (not shown).
  • Send module Used to send registration messages to the server.
  • the receiving module is configured to receive a successful registration message returned by the server after successfully registering according to the registration message.
  • the above modules included in the terminal device are registered in the form of a service.
  • the terminal device When the terminal device is started, it automatically runs in the background and is shielded from the user. The user can directly transfer the two terminal devices to transmit files.
  • the first establishing module establishes a first transmission link with the server
  • the destination terminal device establishes a third transmission link with the server, and searches when the source terminal device transmits the file to be transmitted to the destination terminal device.
  • the module searches for the destination terminal device in the local area network where the source terminal device is located. If yes, the second connection link is directly established between the second establishing module and the destination terminal device, and the first transmission module passes the second transmission link to the destination terminal.
  • the device transmits the file to be transmitted. Since the source terminal device and the destination terminal device are located on the same local area network, the transmission speed of the file to be transmitted is increased.
  • the second transmission module forwards the file to be transmitted to the destination terminal device through the server, and ensures that the file to be transmitted successfully reaches the destination terminal device.
  • FIG. 3 is a schematic diagram of another embodiment of the terminal device of the present invention.
  • the terminal device 4 includes a processor 41, a memory 42, and a bus system 43.
  • the processor 41 and the memory 42 are connected by a bus system 43 for storing instructions, and the processor 41 is configured to execute instructions stored by the memory 42 for establishing a first transmission link with the server.
  • the file to be transmitted When the file to be transmitted is sent to the destination terminal device, searching for the destination terminal device in the local area network where the user is located; if the destination terminal device is present, establishing the second transmission with the destination terminal device Transmitting, by the second transmission link, the file to be transmitted to the destination terminal device; if the destination terminal device is not present, sending the to-before to the server by using the first transmission link And transmitting the file, so that the server forwards the file to be transmitted to the destination terminal device by using a third transmission link established between the server and the destination terminal device.
  • the memory 42 can be a non-transitory computer readable storage medium for storing computer executable instructions that, when executed by one or more processors 41, can cause the processor 41 to perform the steps of the method embodiments below, such as Step S401 to step S407 as described in FIG. 4;
  • the processor performs the functions of the various modules of the above apparatus embodiments, for example, the functions of the modules 301 to 315 as shown in FIG. 2, and the computer executable instructions may also be stored and/or transmitted in any non-transitory computer readable storage medium.
  • an instruction execution system, apparatus, or device such as a computer-based system, a system including a processor, or an instruction execution system, apparatus Or other system in which the device fetches instructions and executes the instructions.
  • Non-transitory computer readable storage medium can be any medium that tangibly contains or stores computer-executable instructions, which can be used by an instruction execution system, device, or system Or use in conjunction with an instruction execution system, device, or device.
  • Non-volatile computer readable storage media may include, but are not limited to, magnetic, optical, and/or semiconductor storage devices. Examples of such storage devices include magnetic disks, CD-ROM based on CD, DVD or Blu-ray technology, and persistent solid-state memories (such as flash memory, solid state drives, etc.).
  • the processor 41 may be a central processing unit ("CPU").
  • the processor 41 can also be other general purpose processors, digital signal processors (DSPs), application specific integrated circuits (ASICs), off-the-shelf programmable gate arrays (FPGAs) or other programmable logic devices, discrete gates or transistor logic devices, discrete Hardware components, etc.
  • DSPs digital signal processors
  • ASICs application specific integrated circuits
  • FPGAs off-the-shelf programmable gate arrays
  • the general purpose processor may be a microprocessor or the processor or any conventional processor or the like.
  • the bus system 43 may include a power bus, a control bus, a status signal bus, and the like in addition to the data bus. However, for clarity of description, various buses are labeled as the bus system 43 in the figure.
  • the terminal device 4 is not limited to the components and configurations of FIG. 4, and may include other or additional components in various configurations.
  • each step of the above method or each module of the device may be completed by an integrated logic circuit of hardware in the processor 41 or an instruction in the form of software.
  • the elements of the steps or apparatus of the method disclosed in connection with the embodiments of the present application may be directly embodied as hardware processor execution completion. Or complete with a combination of hardware and software modules in the processor.
  • the software module can be located in a conventional storage medium such as random access memory, flash memory, read only memory, programmable read only memory or electrically erasable programmable memory, registers, and the like.
  • the storage medium is located in the memory 42, and the processor 41 reads the memory 42 Information, combined with its hardware to complete the steps of the above method. To avoid repetition, it will not be described in detail here.
  • the source terminal device and the destination terminal device respectively establish a first transmission link and a third transmission link with the server.
  • the source terminal device transmits the file to be transmitted to the destination terminal device
  • the source terminal device first determines the purpose. Whether the terminal device is located in the local area network where the source terminal device is located, if yes, the second transmission link is directly established between the source terminal device and the destination terminal device, and the source terminal device transmits the file to be transmitted to the destination terminal device through the second transmission link.
  • the source terminal device and the destination terminal device are located in the same local area network, and when the file to be transmitted is transmitted in the local area network, the transmission speed is faster, thereby improving the transmission speed of the file to be transmitted transmitted between the terminal devices.
  • the source terminal device forwards the file to be transmitted to the destination terminal device through the server, and ensures that the file to be transmitted successfully reaches the destination terminal device.
  • the present invention further provides a method implementation method for transferring files between terminal devices.
  • the method includes:
  • Step S401 Establish a first transmission link with the server
  • the terminal device sends a detection packet to the server periodically through the first transmission link to detect whether the first transmission link is normal with the server.
  • the server responds to the detection packet, the first transmission link is normal.
  • Step S402 When the file to be transmitted is sent to the destination terminal device, it searches for the destination terminal device in the local area network where it is located; if the destination terminal device exists, the process proceeds to step S403, otherwise proceeds to step S405;
  • step S402 further includes:
  • Step S4021 Broadcasting a search message to the local area network where the search message is located, where the search message carries the identifier of the destination terminal device;
  • the identifier of the destination terminal device may be an IP address or a MAC address of the destination terminal device.
  • Step S4022 After receiving the response message returned by the destination terminal device according to the search message, If there is no response message returned by the destination terminal device, the destination terminal device does not exist in the local area network.
  • the other terminal devices of the local area network determine whether the identifier carried in the search packet is the same as the identifier of the search packet. If they are the same, the response is returned. If the response packet is not the same, the response packet does not respond. deal with.
  • all the terminal devices may also be configured to return a response message, and the response message may carry different content, and determine whether the terminal device and the destination terminal device are located by using the content carried in the response message.
  • Step S403 Establish a second transmission link with the destination terminal device.
  • the detection packet can be sent to the destination terminal device periodically through the second transmission link.
  • the second transmission link is normal.
  • both the first transmission link and the second transmission link are preferably TCP links.
  • Step S404 Send a file to be transmitted to the destination terminal device by using the second transmission link.
  • Step S405 The file to be transmitted is sent to the server through the first transmission link, so that the server forwards the file to be transmitted to the destination terminal device through the third transmission link established between the server and the destination terminal device.
  • the third transmission link is also preferably a TCP link.
  • the server may be inquired whether to establish a second transmission link with the destination terminal device. Specifically, as shown in FIG. 6, step S405 includes:
  • Step S4051 Send a file transmission request message to the server by using the first transmission link, where the file transmission request message carries the identifier of the destination terminal device;
  • Step S4052 Receive a file transfer permission message returned by the server, where the file transfer permission message is a message returned by the server when the server finds a third transmission link with the destination terminal device according to the file transfer request;
  • Step S4053 Send the file to be transmitted to the server through the first transmission link according to the file transmission permission message, so that the server forwards the file to be transmitted to the destination terminal device.
  • the first transmission link and destination terminal established between the terminal device and the server are The third transmission link between the standby device and the server may be pre-established.
  • the terminal device and the destination terminal device first establish a transmission link with the server when starting, and the first transmission link and the second transmission link may also be needed according to the needs.
  • the terminal device when the terminal device forwards the file to be transmitted through the server, the terminal device may first register as a member of the server, and the method further includes:
  • Step S406 Send a registration message to the server
  • the server After receiving the registration message, the server registers according to the registration message and returns a successful registration message after the registration is successful.
  • Step S407 The receiving server returns a successful registration message after successfully registering according to the registration message;
  • the terminal device After receiving the successful registration message, it is known that the terminal device has become a member of the server, and the terminal device can establish a transmission link by the server.
  • the server When the server establishes a transmission link with the terminal device, it can first determine whether the terminal device is a registered member. If not, the terminal device needs to be registered as a member before the transmission link is allowed to be established.
  • the source terminal device and the destination terminal device respectively establish a first transmission link and a third transmission link with the server.
  • the source terminal device transmits the file to be transmitted to the destination terminal device
  • the source terminal device first determines the purpose. Whether the terminal device is located in the local area network where the source terminal device is located, if yes, the second transmission link is directly established between the source terminal device and the destination terminal device, and the source terminal device transmits the file to be transmitted to the destination terminal device through the second transmission link.
  • the source terminal device and the destination terminal device are located in the same local area network, and when the file to be transmitted is transmitted in the local area network, the transmission speed is faster, thereby improving the transmission speed of the file to be transmitted transmitted between the terminal devices.
  • the source terminal device forwards the file to be transmitted to the destination terminal device through the server, and ensures that the file to be transmitted successfully reaches the destination terminal device.

Abstract

本发明公开了一种终端设备间传输文件的方法、终端设备及文件传输系统,方法包括:建立与服务器之间的第一传输链路;当向目的终端设备发送待传输文件时,在其自身所在的局域网内搜索是否存在所述目的终端设备;若存在所述目的终端设备,则建立与所述目的终端设备之间的第二传输链路;通过所述第二传输链路向所述目的终端设备发送所述待传输文件;若没有存在所述目的终端设备,则通过所述第一传输链路向所述服务器发送所述待传输文件,以使所述服务器通过服务器与目的终端设备之间建立的第三传输链路向目的终端设备转发所述待传输文件。通过上述方式,本发明能够提高终端设备之间传输待传输文件的传输速度。

Description

终端设备间传输文件的方法、终端设备及文件传输系统 【技术领域】
本发明涉及数据传输技术领域,特别是涉及终端设备间传输文件的方法、终端设备及文件传输系统。
【背景技术】
随着智能手机的发展,智能手机的功能越来越强大,其容量越来越大,所存储的文件的种类也越来越多。智能手机经常需要与其它智能手机或者电脑互传文件,以实现文件共享或者协同办公。
现有技术中智能手机互传文件的方式包括蓝牙传输和电脑中转传输。蓝牙传输是指两智能手机直接进行蓝牙连接,然后通过蓝牙进行无线传输,但是蓝牙传输只允许点对点传输,并且蓝牙所允许的连接距离也很短,只有几十米,非常不方便。电脑中转传输是指源智能手机先通过数据线与电脑连接,将待传输文件上传至电脑,然后源智能手机与电脑断开连接,接着,目的智能手机通过数据线与电脑连接,再从电脑下载待传输文件,电脑中转传输也非常麻烦,并且受数据线的限制。因此,现有技术中智能手机间互传文件的非常不方便。
【发明内容】
本发明主要解决的技术问题是提供一种终端设备间传输文件的方法、终端设备及文件传输系统,在终端设备间传输待传输文件时,主要是通过网络进行传输,方便智能手机间传输待传输文件;另外,终端设备在传输待传输文件时还能够智能选择传输网络,提高待传输文件的传输速度。
为解决上述技术问题,本发明采用的一个技术方案是:提供一种终端设备间传输文件的方法,包括:建立与服务器之间的第一传输链路;当向目的终端设备发送待传输文件时,在其自身所在的局域网内搜索是否存在所述目的终端设备;若存在所述目的终端设备,则建立与所述目的终端设备之间的第二传输 链路;通过所述第二传输链路向所述目的终端设备发送所述待传输文件;若没有存在所述目的终端设备,则通过所述第一传输链路向所述服务器发送所述待传输文件,以使所述服务器通过服务器与目的终端设备之间建立的第三传输链路向目的终端设备转发所述待传输文件。
其中,所述通过所述第一传输链路向所述服务器发送所述待传输文件,以使所述服务器通过服务器与目的终端设备之间建立的第三传输链路向目的终端设备转发所述待传输文件的步骤包括:通过所述第一传输链路向所述服务器发送文件传输请求报文,其中,所述文件传输请求报文携带所述目的终端设备的标识;接收所述服务器返回的文件传输许可报文,其中,所述文件传输许可报文是服务器在根据所述文件传输请求查找到所述服务器与目的终端设备建立有第三传输链路时返回的报文;根据所述文件传输许可报文,所述通过所述第一传输链路向所述服务器发送所述待传输文件,以使所述服务器向目的终端设备转发所述待传输文件。
其中,所述在其自身所在的局域网内搜索是否存在所述目的终端设备的步骤包括:向所述其自身所在的局域网广播搜索报文,其中,所述搜索报文携带所述目的终端设备的标识;在接收到所述目的终端设备根据所述搜索报文返回的应答报文,则判定其自身所在所述局域网内存在所述目的终端设备,若没有接收到所述目的终端设备返回的应答报文,则判定其自身所在所述局域网内不存在所述目的终端设备。
其中,所述应答报文携带目的终端设备的IP地址和端口;所述第一传输链路、第二传输链路和第三传输链路均为TCP链路。
其中,在所述建立与服务器之间的第一传输链路的步骤之前,所述方法还包括:向所述服务器发送注册报文;接收所述服务器根据注册报文成功注册后返回的成功注册报文。
为解决上述技术问题,本发明采用的另一个技术方案是:提供一种终端设备,包括第一建立模块,用于建立与服务器之间的第一传输链路;搜索模块, 用于当向目的终端设备发送待传输文件时,在其自身所在的局域网内搜索是否存在所述目的终端设备;第二建立模块,用于当所述搜索模块搜索到目的终端设备时,建立与所述目的终端设备之间的第二传输链路;第一传输模块,用于通过所述第二传输链路向所述目的终端设备发送所述待传输文件;第二传输模块,用于当所述搜索模块没有搜索到目的终端设备时,通过所述第一传输链路向所述服务器发送所述待传输文件,以使所述服务器通过服务器与目的终端设备之间建立的第三传输链路向目的终端设备转发所述待传输文件。
其中,所述第二传输模块包括:第一发送单元,用于通过所述第一传输链路向所述服务器发送文件传输请求报文,其中,所述文件传输请求报文携带所述目的终端设备的标识;接收单元,用于接收所述服务器返回的文件传输许可报文,其中,所述文件传输许可报文是服务器在根据所述文件传输请求查找到所述服务器与目的终端设备建立有第三传输链路时返回的报文;第二发送单元,用于根据所述文件传输许可报文,所述通过所述第一传输链路向所述服务器发送所述待传输文件,以使所述服务器向目的终端设备转发所述待传输文件。
其中,所述搜索模块包括:广播单元,用于向所述其自身所在的局域网广播搜索报文,其中,所述搜索报文携带所述目的终端设备的标识;判定单元,用于在接收到所述目的终端设备根据所述搜索报文返回的应答报文,则判定其自身所在所述局域网内存在所述目的终端设备,若没有接收到所述目的终端设备返回的应答报文,则判定其自身所在所述局域网内不存在所述目的终端设备。其中,所述应答报文携带目的终端设备的IP地址和端口;所述第一传输链路、第二传输链路和第三传输链路均为TCP链路。
为解决上述技术问题,本发明采用的另一个技术方案是:提供一种文件传输系统,包括服务器、源终端设备和目的终端设备,其中,所述源终端设备与服务器建立有第一传输链路,所述目的终端设备与服务器建立有第三传输链路;所述源终端设备,用于当向目的终端设备发送待传输文件时,在其自身所在的局域网内搜索是否存在所述目的终端设备,若存在所述目的终端设备,则建立 与所述目的终端设备之间的第二传输链路,通过所述第二传输链路向所述目的终端设备发送所述待传输文件,若没有存在所述目的终端设备,则通过所述第一传输链路向所述服务器发送所述待传输文件,以使所述服务器通过第三传输链路向目的终端设备转发所述待传输文件。
本发明的有益效果是:区别于现有技术的情况,本发明源终端设备与目的终端设备分别与服务器建立第一传输链路和第三传输链路,当源终端设备向目的终端设备传输待传输文件时,源终端设备先判断目的终端设备是否位于源终端设备所在的局域网内,若在,则源终端设备和目的终端设备之间直接建立第二传输链路,源终端设备通过第二传输链路向目的终端设备传输待传输文件,而源终端设备和目的终端设备位于同一个局域网,待传输文件在局域网内传输时,其传输速度更快,从而提高待传输文件在终端设备之间传输的传输速度。当源终端设备与目的终端设备不位于同一局域网内,源终端设备通过服务器向目的终端设备转发待传输文件,保证待传输文件顺利到达目的终端设备。
【附图说明】
图1是本发明文件传输系统实施方式的示意图;
图2是本发明终端设备实施方式的示意图;
图3是本发明终端设备另一实施方式的示意图;
图4是本发明终端设备间传输文件的方法实施方式的流程图;
图5是本发明终端设备间传输文件的方法实施方式判断终端设备与目的终端设备是否位于同一局域网的流程图;
图6是本发明终端设备间传输文件的方法实施方式中通过服务器向目的终端设备转发待传输文件的流程图。
【具体实施方式】
下面结合附图和实施方式对本发明进行详细说明。
请参阅图1,文件传输系统20包括服务器21、源终端设备22和目的终端设备23。源终端设备22与服务器21建立有第一传输链路,目的终端设备23与服务器21建立有第三传输链路。源终端设备22和目的终端设备23可以为个人计算机、智能手机、PDA或者平板电脑等等。
源终端设备22用于当向目的终端设备23发送待传输文件时,在其自身所在的局域网内搜索是否存在目的终端设备23,若存在目的终端设备23,则建立与目的终端设备23之间的第二传输链路,通过第二传输链路向目的终端设备23发送待传输文件,若没有存在目的终端设备23,则通过第一传输链路向服务器21发送待传输文件,以使服务器21通过第三传输链路向目的终端设备23转发待传输文件。
待传输文件在局域网内传输时,由于不需要经过太多网络节点的转发,因此,待传输文件在局域网的传输速度通常会比在广域网内传输速度要快。当源终端设备22与目的终端设备23位于同一局域网时,直接建立源终端设备22和目的终端设备23之间的第二传输链路,然后通过第二传输链路传输待传输文件,大大提高了待传输文件的传输速度。当源终端设备22与目的终端设备23不是位于同一个局域网时,待传输文件通过服务器21进行转发,保证待传输文件顺利到达目的终端设备23。
为了避免待传输文件丢失,在通过服务器21转发待传输文件时,需要询问服务器21是否建立有与目的终端设备23之间的第三传输链路,只有服务器21建立有与目的终端设备23之间的第三传输链路时,才允许服务器21转发待传输文件,具体的,源终端设备22通过第一传输链路向服务器21发送文件传输请求报文,其中,文件传输请求报文携带目的终端设备23的标识。服务器21接收到文件传输请求报文后,判断是否与建立有目的终端设备23之间的第三传输链路,若有,则返回文件传输许可报文,若没,则重新建立与目的终端设备23之间的第三传输链路,建立成功后返回文件传输许可报文,否则返回不允许传输文件报文。目的终端设备23接收到服务器21返回的文件传输许可报文后, 根据文件传输许可报文,通过第一传输链路向服务器21发送待传输文件,以使服务器21向目的终端设备23转发待传输文件。当然,待传输文件也会携带目的终端设备23的标识,以使服务器21在接收到待传输文件后,获知向哪个终端设备进行转发。在本实施方式中,目的终端设备23的标识优选为目的终端设备23的IP地址以及端口。
进一步的,源终端设备22在其自身所在的局域网内搜索是否存在目的终端设备23主要是通过广播报文的方式实现,具体为:目的终端设备23向其自身所在的局域网广播搜索报文,其中,搜索报文携带目的终端设备23的标识。局域网内的终端设备接收到搜索报文时,判断搜索报文携带的标识是否与自身的标识相同,若相同,则返回应答报文,若不相同,则不处理。源终端设备22在接收到目的终端设备23根据搜索报文返回的应答报文,则判定其自身所在的局域网内存在目的终端设备23,若没有接收到目的终端设备23返回的应答报文,则判定其自身所在的局域网内不存在目的终端设备23。当然,在其它替代实施方式中,也不限定于通过上述方式搜索局域网内是否存在目的终端设备23,例如:源终端设备22广播另一种搜索报文,局域网内的终端设备在接收到另一种搜索报文时,均返回自身的标识,源终端设备22根据返回的标识判断局域网是否存在目的终端设备23。
值得说明的是:源终端设备22搜索局域网内其它终端设备的功能在源终端设备22启动时直接注册成一种服务,例如:NSD局域网发现服务,当源终端设备22需要向目的终端设备23发送待传输文件时,源终端设备22通过NSD局域网发现服务搜索自身所在的局域网内是否存在目的终端设备23。当然,局域网内的其它终端设备也与源终端设备22类似,也同样注册NSD局域网发现服务。进一步的,而局域网的终端设备在启动时初了启动NSD局域网发现服务,也可以启动链路建立服务,链路建立服务用于建立终端设备与服务器21之间的传输链路。在本实施方式中,第一传输链路、第二传输链路和第三传输链路均为TCP链路。
当然,在源终端设备22和目的终端设备23在启动时建立与服务器21之间的传输链路时,需要先向服务器21注册,则源终端设备22向服务器21发送注册报文。注册报文携带源终端设备22的相关信息,例如:源终端设备22的MAC地址和IMEI序列号等等。为了保证注册报文的安全,注册报文还可以进行加密处理,例如:将MAC和IMEI序列号拼接起来并进行base64加密,并将加密后的数据发送给服务器21进行注册。服务器21在注册成功后,返回成功注册报文,成功注册报文中可以携带服务器21给源终端设备22分配的设备ID,其中,设备ID可以是唯一的。设备ID也可以作为源终端设备22的标识。源终端设备22接收成功注册报文。
在本发明实施方式中,源终端设备与目的终端设备分别与服务器建立第一传输链路和第三传输链路,当源终端设备向目的终端设备传输待传输文件时,源终端设备先判断目的终端设备是否位于源终端设备所在的局域网内,若在,则源终端设备和目的终端设备之间直接建立第二传输链路,源终端设备通过第二传输链路向目的终端设备传输待传输文件,而源终端设备和目的终端设备位于同一个局域网,提高待传输文件的传输速度。当源终端设备与目的终端设备不位于同一局域网内,源终端设备通过服务器向目的终端设备转发待传输文件,保证待传输文件顺利到达目的终端设备。
本发明又提供了一种终端设备实施方式。请参阅图2,终端设备30包括第一建立模块301、搜索模块302、第二建立模块303、第一传输模块304和第二传输模块305。
第一建立模块301,用于建立与服务器之间的第一传输链路。搜索模块302,用于当向目的终端设备发送待传输文件时,在其自身所在的局域网内搜索是否存在目的终端设备。第二建立模块303,用于当搜索模块302搜索到目的终端设备时,建立与目的终端设备之间的第二传输链路。第一传输模块304,用于通过第二传输链路向目的终端设备发送待传输文件。第二传输模块305,用于当搜索模块302没有搜索到目的终端设备时,通过第一传输链路向服务器发送待传输 文件,以使服务器通过服务器与目的终端设备之间建立的第三传输链路向目的终端设备转发待传输文件。
而待传输文件在局域网内传输的速度时会比在广域网内传输的速度要快,因此,当源终端设备与目的终端设备位于同一局域网时,源终端设备和目的终端设备之间直接建立第二传输链路进行传输,可以大大提高了待传输文件的传输速度。当源终端设备与目的终端设备不是位于同一个局域网时,则通过服务器进行转发,保证待传输文件顺利到达目的终端设备。
为了避免待传输文件丢失,在通过服务器转发待传输文件时,可先询问服务器是否与目的终端设备建立第二传输链路,具体的,第二传输模块305包括第一发送单元3051、接收单元3052和第二发送单元3053。
第一发送单元3051,用于通过第一传输链路向服务器发送文件传输请求报文,其中,文件传输请求报文携带目的终端设备的标识。接收单元3052,用于接收服务器返回的文件传输许可报文,其中,文件传输许可报文是服务器在根据文件传输请求查找到服务器与目的终端设备建立有第三传输链路时返回的报文。第二发送单元3053,用于根据文件传输许可报文,通过第一传输链路向服务器发送待传输文件,以使服务器向目的终端设备转发待传输文件。
而终端设备在搜索目的终端设备是否在同一局域网时,可以通过广播搜索报文的方式来实现,具体的,搜索模块302包括广播单元3021和判定单元3022。
广播单元3021,用于向其自身所在的局域网广播搜索报文,其中,搜索报文携带目的终端设备的标识。判定单元3022,用于在接收到目的终端设备根据搜索报文返回的应答报文,则判定其自身所在的局域网内存在目的终端设备,若没有接收到目的终端设备返回的应答报文,则判定其自身所在的局域网内不存在目的终端设备。在本实施方式中,优选的,应答报文携带目的终端设备的IP地址和端口;第一传输链路、第二传输链路和第三传输链路均为TCP链路。
而终端设备在通过服务器转发待传输文件时,需要先注册成为服务器的会员,则终端设备还包括发送模块(图未示)和接收模块(图未示)。发送模块, 用于向服务器发送注册报文。接收模块,用于接收服务器根据注册报文成功注册后返回的成功注册报文。
值得说明的是:终端设备所包括的上述模块均注册成服务的形式,当终端设备启动时,自动在后台运行,对用户屏蔽,用户可以直接使两个终端设备进行传输待传输文件。
在本发明实施方式中,第一建立模块与服务器建立起第一传输链路,而目的终端设备与服务器建立起第三传输链路,当源终端设备向目的终端设备传输待传输文件时,搜索模块搜索目的终端设备是否位于源终端设备所在的局域网内,若在,则第二建立模块与目的终端设备之间直接建立第二传输链路,第一传输模块通过第二传输链路向目的终端设备传输待传输文件,由于源终端设备和目的终端设备位于同一个局域网,提高待传输文件的传输速度。当源终端设备与目的终端设备不位于同一局域网内,第二传输模块通过服务器向目的终端设备转发待传输文件,保证待传输文件顺利到达目的终端设备。
请参阅图3,图3是本发明终端设备另一实施方式的示意图。终端设备4包括:处理器41、存储器42、总线系统43。其中,处理器41和存储器42通过总线系统43相连,该存储器42用于存储指令,该处理器41用于执行该存储器42存储的指令,用于:建立与服务器之间的第一传输链路;当向目的终端设备发送待传输文件时,在其自身所在的局域网内搜索是否存在所述目的终端设备;若存在所述目的终端设备,则建立与所述目的终端设备之间的第二传输链路;通过所述第二传输链路向所述目的终端设备发送所述待传输文件;若没有存在所述目的终端设备,则通过所述第一传输链路向所述服务器发送所述待传输文件,以使所述服务器通过服务器与目的终端设备之间建立的第三传输链路向目的终端设备转发所述待传输文件。
存储器42可以是非易失性计算机可读存储介质,以用于存储计算机可执行指令,该指令当由一个或多个处理器41执行时,可以使得处理器41执行以下方法实施方式的步骤,比如,如图4描述的步骤S401~步骤S407;也可以使得 处理器执行以上装置实施方式各模块的功能,比如,如图2所示模块301至315的功能,计算机可执行指令也可以在任何非易失性计算机可读存储介质内存储和/或传输,以便由指令执行系统、装置或设备使用,或者结合指令执行系统、装置或设备使用,其中该指令执行系统、装置或设备诸如基于计算机的系统、包含处理器的系统或可以从指令执行系统、装置或设备获取指令并执行该指令的其他系统。出于本文档的目的,“非易失性计算机可读存储介质”可以是有形地包含或存储计算机可执行指令的任何介质,该计算机可执行指令可以用于由指令执行系统、设备或系统使用或者结合指令执行系统、装置或设备使用。非易失性计算机可读存着介质可以包括但不限于磁的、光的和/或半导体存储装置。这些存储装置的示例包括磁盘、基于CD、DVD或蓝光技术的光盘以及持久性固态存储器(诸如,闪存、固态驱动器等)。
应当理解,在本申请实施方式中,该处理器41可以是中央处理单元(Central Processing Unit,简称为“CPU”)。该处理器41还可以是其他通用处理器、数字信号处理器(DSP)、专用集成电路(ASIC)、现成可编程门阵列(FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。
该总线系统43除包括数据总线之外,还可以包括电源总线、控制总线和状态信号总线等。但是为了清楚说明起见,在图中将各种总线都标为总线系统43。
在本发明实施方式中,终端设备4不限于图4的部件和配置,还可以包括以多种配置形式的其他或附加部件。
在实现过程中,上述方法的各步骤或装置的各模块可以通过处理器41中的硬件的集成逻辑电路或者软件形式的指令完成。结合本申请实施方式所公开的方法的步骤或装置的各单元可以直接体现为硬件处理器执行完成。或者用处理器中的硬件及软件模块组合执行完成。软件模块可以位于随机存储器,闪存、只读存储器,可编程只读存储器或者电可擦写可编程存储器、寄存器等本领域成熟的存储介质中。该存储介质位于存储器42,处理器41读取存储器42中的 信息,结合其硬件完成上述方法的步骤。为避免重复,这里不再详细描述。在本发明实施方式中,源终端设备与目的终端设备分别与服务器建立第一传输链路和第三传输链路,当源终端设备向目的终端设备传输待传输文件时,源终端设备先判断目的终端设备是否位于源终端设备所在的局域网内,若在,则源终端设备和目的终端设备之间直接建立第二传输链路,源终端设备通过第二传输链路向目的终端设备传输待传输文件,而源终端设备和目的终端设备位于同一个局域网,待传输文件在局域网内传输时,其传输速度更快,从而提高待传输文件在终端设备之间传输的传输速度。当源终端设备与目的终端设备不位于同一局域网内,源终端设备通过服务器向目的终端设备转发待传输文件,保证待传输文件顺利到达目的终端设备。
本发明又提供终端设备间传输文件的方法实施方式。请参阅图4,方法包括:
步骤S401:建立与服务器之间的第一传输链路;
终端设备为检测与服务器之间的第一传输链路是否正常,可以通过第一传输链路定期向服务器发送检测报文,服务器响应检测报文时,则说明第一传输链路正常。
步骤S402:当向目的终端设备发送待传输文件时,在其自身所在的局域网内搜索是否存在目的终端设备;若存在目的终端设备,则进入步骤S403,否则进入步骤S405;
终端设备在自身的所在的局域网内搜索到目的终端设备时,则说明终端设备与目的终端设备位于同一局域网内。具体的,在其自身所在的局域网内搜索是否存在目的终端设备主要是通过广播报文的方式实现,则如图5所示,步骤S402又包括:
步骤S4021:向其自身所在的局域网广播搜索报文,其中,搜索报文携带目的终端设备的标识;
目的终端设备的标识可以为目的终端设备的IP地址或者MAC地址。
步骤S4022:在接收到目的终端设备根据搜索报文返回的应答报文,则判 定其自身所在的局域网内存在目的终端设备,若没有接收到目的终端设备返回的应答报文,则判定其自身所在的局域网内不存在目的终端设备。
局域网的其它终端设备在接收到搜索报文时,会判断搜索报文所携带的标识是否与自身的标识相同,若相同,则响应,返回一个应答报文若不相同,则不响应,不任何处理。当然,在其它替代实施方式中,也可以设置所有的终端设备均返回应答报文,应答报文可以携带不同的内容,通过应答报文所携带的内容进行判断终端设备与目的终端设备是否位于同一局域网内。
步骤S403:建立与目的终端设备之间的第二传输链路;
终端设备与目的终端设备建立第二传输链路后,也可以通过第二传输链路定期向目的终端设备发送检测报文,当目的终端设备响应,则说明第二传输链路正常。在本实施方式中,第一传输链路和第二传输链路均优选为TCP链路。
步骤S404:通过第二传输链路向目的终端设备发送待传输文件;
步骤S405:通过第一传输链路向服务器发送待传输文件,以使服务器通过服务器与目的终端设备之间建立的第三传输链路向目的终端设备转发待传输文件。
第三传输链路也优选为TCP链路。为了避免待传输文件丢失,在通过服务器转发待传输文件时,可先询问服务器是否与目的终端设备建立第二传输链路,具体的,如图6所示,步骤S405包括:
步骤S4051:通过第一传输链路向所述服务器发送文件传输请求报文,其中,文件传输请求报文携带目的终端设备的标识;
步骤S4052:接收服务器返回的文件传输许可报文,其中,文件传输许可报文是服务器在根据文件传输请求查找到服务器与目的终端设备建立有第三传输链路时返回的报文;
步骤S4053:根据文件传输许可报文,通过第一传输链路向服务器发送待传输文件,以使服务器向目的终端设备转发待传输文件。
值得说明的是:终端设备与服务器之间建立的第一传输链路和目的终端设 备与服务器之间的第三传输链路可以预先建立,例如:终端设备和目的终端设备在启动时,先与服务器建立传输链路,第一传输链路和第二传输链路也可以根据需要建立,例如:终端设备搜索到与目的终端设备不位于同一个局域时,终端设备才与服务器建立第一传输链路,服务器在接收到文件传输请求报文时,才与目的终端设备建立第三传输链路。
进一步,终端设备通过服务器转发待传输文件时,终端设备可以先注册成为服务器的会员,则方法还包括:
步骤S406:向服务器发送注册报文;
服务器在接收到注册报文后,会根据注册报文进行注册,在注册成功后返回成功注册报文。
步骤S407:接收服务器根据注册报文成功注册后返回的成功注册报文;
接收到成功注册报文后,获知终端设备已经成为服务器的会员,终端设备才可以服务器建立传输链路。服务器与终端设备建立传输链路时,可以先判断终端设备是否为注册会员,若不,需要终端设备先注册成为会员,才允许建立传输链路。
在本发明实施方式中,源终端设备与目的终端设备分别与服务器建立第一传输链路和第三传输链路,当源终端设备向目的终端设备传输待传输文件时,源终端设备先判断目的终端设备是否位于源终端设备所在的局域网内,若在,则源终端设备和目的终端设备之间直接建立第二传输链路,源终端设备通过第二传输链路向目的终端设备传输待传输文件,而源终端设备和目的终端设备位于同一个局域网,待传输文件在局域网内传输时,其传输速度更快,从而提高待传输文件在终端设备之间传输的传输速度。当源终端设备与目的终端设备不位于同一局域网内,源终端设备通过服务器向目的终端设备转发待传输文件,保证待传输文件顺利到达目的终端设备。
以上所述仅为本发明的实施方式,并非因此限制本发明的专利范围,凡是利用本发明说明书及附图内容所作的等效结构或等效流程变换,或直接或间接 运用在其他相关的技术领域,均同理包括在本发明的专利保护范围内。

Claims (10)

  1. 一种终端设备间传输文件的方法,其特征在于,包括:
    建立与服务器之间的第一传输链路;
    当向目的终端设备发送待传输文件时,在其自身所在的局域网内搜索是否存在所述目的终端设备;
    若存在所述目的终端设备,则建立与所述目的终端设备之间的第二传输链路;
    通过所述第二传输链路向所述目的终端设备发送所述待传输文件;
    若没有存在所述目的终端设备,则通过所述第一传输链路向所述服务器发送所述待传输文件,以使所述服务器通过服务器与目的终端设备之间建立的第三传输链路向目的终端设备转发所述待传输文件。
  2. 根据权利要求1所述的方法,其特征在于,
    所述通过所述第一传输链路向所述服务器发送所述待传输文件,以使所述服务器通过服务器与目的终端设备之间建立的第三传输链路向目的终端设备转发所述待传输文件的步骤包括:
    通过所述第一传输链路向所述服务器发送文件传输请求报文,其中,所述文件传输请求报文携带所述目的终端设备的标识;
    接收所述服务器返回的文件传输许可报文,其中,所述文件传输许可报文是服务器在根据所述文件传输请求查找到所述服务器与目的终端设备建立有第三传输链路时返回的报文;
    根据所述文件传输许可报文,所述通过所述第一传输链路向所述服务器发送所述待传输文件,以使所述服务器向目的终端设备转发所述待传输文件。
  3. 根据权利要求1所述的方法,其特征在于,
    所述在其自身所在的局域网内搜索是否存在所述目的终端设备的步骤包括:
    向所述其自身所在的局域网广播搜索报文,其中,所述搜索报文携带所述目的终端设备的标识;
    在接收到所述目的终端设备根据所述搜索报文返回的应答报文,则判定其自身所在所述局域网内存在所述目的终端设备,若没有接收到所述目的终端设备返回的应答报文,则判定其自身所在所述局域网内不存在所述目的终端设备。
  4. 根据权利要求3所述的方法,其特征在于,
    所述应答报文携带目的终端设备的IP地址和端口;
    所述第一传输链路、第二传输链路和第三传输链路均为TCP链路。
  5. 根据权利要求1所述的方法,其特征在于,
    在所述建立与服务器之间的第一传输链路的步骤之前,所述方法还包括:
    向所述服务器发送注册报文;
    接收所述服务器根据注册报文成功注册后返回的成功注册报文。
  6. 一种终端设备,其特征在于,包括:
    第一建立模块,用于建立与服务器之间的第一传输链路;
    搜索模块,用于当向目的终端设备发送待传输文件时,在其自身所在的局域网内搜索是否存在所述目的终端设备;
    第二建立模块,用于当所述搜索模块搜索到目的终端设备时,建立与所述目的终端设备之间的第二传输链路;
    第一传输模块,用于通过所述第二传输链路向所述目的终端设备发送所述待传输文件;
    第二传输模块,用于当所述搜索模块没有搜索到目的终端设备时,通过所述第一传输链路向所述服务器发送所述待传输文件,以使所述服务器通过服务器与目的终端设备之间建立的第三传输链路向目的终端设备转发所述待传输文件。
  7. 根据权利要求6所述的终端设备,其特征在于,所述第二传输模块包括:
    第一发送单元,用于通过所述第一传输链路向所述服务器发送文件传输请 求报文,其中,所述文件传输请求报文携带所述目的终端设备的标识;
    接收单元,用于接收所述服务器返回的文件传输许可报文,其中,所述文件传输许可报文是服务器在根据所述文件传输请求查找到所述服务器与目的终端设备建立有第三传输链路时返回的报文;
    第二发送单元,用于根据所述文件传输许可报文,所述通过所述第一传输链路向所述服务器发送所述待传输文件,以使所述服务器向目的终端设备转发所述待传输文件。
  8. 根据权利要求6所述的终端设备,其特征在于,所述搜索模块包括:
    广播单元,用于向所述其自身所在的局域网广播搜索报文,其中,所述搜索报文携带所述目的终端设备的标识;
    判定单元,用于在接收到所述目的终端设备根据所述搜索报文返回的应答报文,则判定其自身所在所述局域网内存在所述目的终端设备,若没有接收到所述目的终端设备返回的应答报文,则判定其自身所在所述局域网内不存在所述目的终端设备。
  9. 权利要求8所述的终端设备,其特征在于,
    所述应答报文携带目的终端设备的IP地址和端口;
    所述第一传输链路、第二传输链路和第三传输链路均为TCP链路。
  10. 一种文件传输系统,其特征在于,包括服务器、源终端设备和目的终端设备,其中,所述源终端设备与服务器建立有第一传输链路,所述目的终端设备与服务器建立有第三传输链路;
    所述源终端设备,用于当向目的终端设备发送待传输文件时,在其自身所在的局域网内搜索是否存在所述目的终端设备,若存在所述目的终端设备,则建立与所述目的终端设备之间的第二传输链路,通过所述第二传输链路向所述目的终端设备发送所述待传输文件,若没有存在所述目的终端设备,则通过所述第一传输链路向所述服务器发送所述待传输文件,以使所述服务器通过第三传输链路向目的终端设备转发所述待传输文件。
PCT/CN2016/089449 2016-03-29 2016-07-08 终端设备间传输文件的方法、终端设备及文件传输系统 WO2017166522A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201610187410.0 2016-03-29
CN201610187410.0A CN105872039A (zh) 2016-03-29 2016-03-29 终端设备间传输文件的方法、终端设备及文件传输系统

Publications (1)

Publication Number Publication Date
WO2017166522A1 true WO2017166522A1 (zh) 2017-10-05

Family

ID=56625949

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2016/089449 WO2017166522A1 (zh) 2016-03-29 2016-07-08 终端设备间传输文件的方法、终端设备及文件传输系统

Country Status (2)

Country Link
CN (1) CN105872039A (zh)
WO (1) WO2017166522A1 (zh)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112491976A (zh) * 2020-11-11 2021-03-12 京东数字科技控股股份有限公司 文件传输方法、装置、服务器及存储介质
CN114615259A (zh) * 2022-04-07 2022-06-10 百富计算机技术(深圳)有限公司 文件传输方法、装置及终端设备

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106790481B (zh) * 2016-12-07 2018-09-04 掌阅科技股份有限公司 设备间数据传输方法、装置、服务器和计算机存储介质
CN108573009B (zh) * 2017-07-03 2021-05-25 北京金山云网络技术有限公司 一种文件搜索方法及装置
CN110049074A (zh) * 2018-01-13 2019-07-23 阿里巴巴集团控股有限公司 数据上传的方法、系统及存储介质和计算机设备
CN109039904B (zh) * 2018-08-01 2020-12-22 武汉绿色网络信息服务有限责任公司 一种应用路由方法和装置
CN114363063A (zh) * 2018-11-01 2022-04-15 西安万像电子科技有限公司 数据传输方法、装置及系统

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6363072B1 (en) * 1997-08-15 2002-03-26 Nec Corporation ATM network communication control system allowing end-to-end connection to be set up with ease and communication control method thereof
CN101605138A (zh) * 2009-07-14 2009-12-16 中兴通讯股份有限公司 文件传输方法及终端
CN105208129A (zh) * 2015-10-10 2015-12-30 南京邻动网络科技有限公司 一种弹性的移动终端文件传输方法

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080107051A1 (en) * 2006-11-07 2008-05-08 Mediatek Inc. System and method for operating a portable electronic device
CN101902826B (zh) * 2010-06-30 2013-09-25 北京乔讯科技有限公司 建立数据连接的方法和系统
CN102098614B (zh) * 2011-02-18 2013-08-07 华为技术有限公司 一种通信方法及装置
CN105207867A (zh) * 2015-10-30 2015-12-30 北京奇艺世纪科技有限公司 设备连接方法和设备连接装置

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6363072B1 (en) * 1997-08-15 2002-03-26 Nec Corporation ATM network communication control system allowing end-to-end connection to be set up with ease and communication control method thereof
CN101605138A (zh) * 2009-07-14 2009-12-16 中兴通讯股份有限公司 文件传输方法及终端
CN105208129A (zh) * 2015-10-10 2015-12-30 南京邻动网络科技有限公司 一种弹性的移动终端文件传输方法

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112491976A (zh) * 2020-11-11 2021-03-12 京东数字科技控股股份有限公司 文件传输方法、装置、服务器及存储介质
CN114615259A (zh) * 2022-04-07 2022-06-10 百富计算机技术(深圳)有限公司 文件传输方法、装置及终端设备
WO2023193599A1 (zh) * 2022-04-07 2023-10-12 深圳市兆珑科技有限公司 文件传输方法、装置及终端设备

Also Published As

Publication number Publication date
CN105872039A (zh) 2016-08-17

Similar Documents

Publication Publication Date Title
WO2017166522A1 (zh) 终端设备间传输文件的方法、终端设备及文件传输系统
TWI552634B (zh) 完成直接傳輸層連接性的伺服器與使用者設備與其電腦程式產品
EP2815551B1 (en) Peer to peer networking and sharing systems and methods
US8144593B2 (en) Method and apparatus for efficient routing in communication networks
WO2018121234A1 (zh) 建立通信连接的方法、设备及系统
WO2015149624A1 (zh) 业务链路选择控制方法以及设备
US20120151089A1 (en) Direct data communication in a peer-to-peer network
US20160088064A1 (en) Storing and transferring application data between devices
JP2016509713A (ja) ワイヤレスドッキングサービスに対してワイヤレスドッキーを認証すること
US10728344B2 (en) Service discovery method, related device, and system
EP3163946B1 (en) Transmission list in wi-fi acces point
US20210273915A1 (en) Multi-access interface for internet protocol security
WO2017041660A1 (zh) 一种路由器远程管理方法、系统和设备
WO2016011885A1 (zh) 一种信息传输方法及装置
KR20120099775A (ko) 애드 혹 피어-투-피어 접속을 위한 분산형 메시지 버스를 이용하는 방법 및 장치
WO2014075255A1 (zh) 一种基于PCIE Switch通信的方法、装置及系统
US11032272B2 (en) Mobile number verification for mobile network-based authentication
US9049012B2 (en) Secured cryptographic communication system
CN113301537B (zh) 用于建立通信连接的方法、装置、电子设备以及存储介质
JP6388938B2 (ja) 発見プローブを介したwi−fiダイレクトサービスの発見
US10200849B1 (en) Systems and methods for auto-pair via a plurality of protocols
WO2019113786A1 (zh) Tfo传输方法、代理服务器和系统
US20160309365A1 (en) Remote Socket Connection for Data Offload
WO2014206104A1 (zh) 一种直连链路通信方法及相关设备、系统
US20200383154A1 (en) Mobile network tool

Legal Events

Date Code Title Description
NENP Non-entry into the national phase

Ref country code: DE

121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 16896294

Country of ref document: EP

Kind code of ref document: A1

122 Ep: pct application non-entry in european phase

Ref document number: 16896294

Country of ref document: EP

Kind code of ref document: A1