METHOD AND APPARATUS FOR SHARING A FILE IN P2P SYSTEM

A method and an apparatus for sharing a file with at least one peer terminal by a terminal in a Peer-to-Peer (P2P) network are provided. The method includes dividing a file allowed to be shared and generating two or more fragment files; generating file division information used for reconstructing the file allowed to be shared by using the fragment files; combining the file division information with each of the fragment files; and transmitting the combined file division information and fragment files to the at least one terminal.

In the following description of the present invention, a detailed description of known functions and configurations incorporated herein will be omitted when it may make the subject matter of the present invention unclear.

As described above, according to the conventional file sharing method in a P2P system, file sharing is not achieved without intervention of the user, and file sharing between terminals is not easily achieved in a network having high mobility.

Accordingly, the present invention provides a method of sharing a file without intervention of the user. Further, the present invention provides a method of sharing a file between different networks by enabling the file to be shared by a terminal moving between different networks.

A concept of a file sharing method according to embodiments of the present invention will be described with reference toFIG. 1.

A terminal111existing in a network110divides a file allowed to be shared into a predetermined number of fragment files, and then transmits fragment files chunk1, chunk2, and chunk3generated by the division to peer terminals112,113, and114. The transmission of the fragment files is performed without intervention of the user. The file allowed to be shared may be a file existing in a particular directory of the terminal111.

Thereafter, when the peer terminals112,113, and114having received one of the fragment files chunk1, chunk2, and chunk3move to other networks120and130, the peer terminals112,113, and114having moved to other networks transmit the previously received fragment files to a peer terminal within the corresponding network. The dotted lines ofFIG. 1show movement paths of each terminal. The peer terminals112,113, and114transmit corresponding fragment files whenever the network is changed, or transmit corresponding fragment files at preset periods.

Meanwhile, the terminal111generates file division information used for reconstructing the original file, that is, the file allowed to be shared by using corresponding fragment files, and makes the generated file division information public on the network. The publication may be separately performed from transmission of the fragment files, or may be integratively performed with the fragment files.

Accordingly, when all the fragment files are received, a terminal131reconstructs the corresponding fragment files with reference to file division information on the corresponding fragment files.

Meanwhile, at least one of the fragment files may be transmitted at the request of the terminal131. For example, it is assumed that the fragment file chunk1is first received by the terminal131. At this time, when the terminal determines that the fragment file chunk1corresponds to a fragment file divided from the file which the user desires with reference to file division information on the corresponding fragment file, the terminal makes a request for transmission of the remaining fragment files chunk2and chunk3from the peer terminals113and114, searches for the corresponding fragment file, and then transmits the corresponding fragment file to the terminal131when the corresponding fragment file is stored therein.

According to the present invention, there is an advantage of sharing the file between terminals without intervention of the user and sharing the file even between terminals moving between the different networks110,120, and130.

FIG. 2is a flowchart describing a file sharing process according to an embodiment of the present invention.FIG. 2illustrates that a file allowed to be shared is divided and then fragment files are generated from a viewpoint of the terminal.

In step201, the user terminal divides the file allowed to be shared and then generates fragment files. Here, the file allowed to be shared refers to a file allowed to be transmitted to the peer terminal The file allowed to be shared may be a file located within a particular directory or a file separately designated by the user.

In dividing the file allowed to be shared, the user terminal may divide the file allowed to be shared based on the number of peer terminals. For example, when the number of peer terminals is three, the user terminal may divide the file allowed to be shared into three files. The number of files to be divided from the file allowed to be shared varies depending on a setting.

In step203, the user terminal generates file division information. The file division information refers to information used for reconstructing the original file, that is, the file allowed to be shared by using the fragment files generated in step201. In an embodiment of the present invention, when the file division information is generated, the user terminal combines the generated file division information with each of the fragment files. An example of the file division information will be described with reference toFIG. 3.

As shown inFIG. 3, according to an embodiment of the present invention, the file division information combined with each fragment file310(chunk N) contains information indicating the file from which the corresponding fragment file310is divided, that is, file identification information320. Also, the file division information combined with each fragment file310contains information322indicating a total number of fragment files divided from the corresponding file and information324indicating an ordinal number of the corresponding fragment file. According to the embodiment, the file division information combined with each fragment file310may contain at least one of category information326indicating the category to which the corresponding file belongs, information328on a size of the corresponding file, and information330on a size of the corresponding fragment file.

Referring back toFIG. 2, in step205, the user terminal transmits each fragment file combined with the file division information to the peer terminals. At this time, the user terminal can transmit one fragment file to one peer terminal. For example, when the file allowed to be shared is divided in to three files and a first fragment file, a second fragment file, and a third fragment file are generated, the user terminal can transmit the first fragment file to a peer terminal A, the second fragment file to a peer terminal B, and the third fragment file to a peer terminal C.

FIG. 4is a flowchart describing the file sharing process according to an embodiment of the present invention.FIG. 4illustrates that the fragment file is received and relayed from the viewpoint of the terminal.

When the fragment file is received in step401, the user terminal stores the corresponding fragment file in a set area, and then proceeds to step403. Here, storing the corresponding fragment file in the set area means storing the corresponding fragment file such that the corresponding fragment file is allowed to be shared with peer terminals. For example, it means storing the corresponding fragment file such that transmission of the corresponding fragment file is automatically performed when an event such as a network change occurs or when there is a transmission request from another peer terminal.

The user terminal determines whether the network is changed in step403, and proceeds to step405when the network is changed. Here, the network change means, for example, a case where the user terminal moves from one Wi-Fi network to another Wi-Fi network, moves from one Wi-Fi network to one ad-hoc network, or moves from one ad-hoc network to another ad-hoc network.

In step405, the user terminal transmits the fragment file received in step401, that is, the fragment file allowed to be shared to peer terminals existing on the changed network.

FIG. 5is a flowchart for describing a file sharing method of making a request for transmission of a fragment file from the viewpoint of the terminal according to an embodiment of the present invention. As described inFIG. 5, the user can more quickly transmit the corresponding file with a priority by designating the file corresponding to a particular category.

When the fragment file is received in step501, the user terminal proceeds to step503. In step503, the user terminal determines whether the received fragment file is a fragment file of the file corresponding to a set category. The set category refers to a category preferred by the user, that is, a category designated by the user, such as a category related to a movie or music. The user terminal refers to file division information combined with the received fragment file in order to determine whether the received fragment file is a fragment file of the file corresponding to the set category. As described above with reference toFIG. 3, the file division information may further contain category information of the corresponding fragment file. Accordingly, the user terminal can determine whether the received fragment file is the fragment file of the file corresponding to the set category with reference to the category information among the file division information of the received fragment file. When the received fragment file is the fragment file of the file corresponding to the set category, the user terminal proceeds to step505.

The user terminal transmits a message requesting transmission of the remaining fragment files of the file including the received fragment file to the peer terminals in step505, and then proceeds to step507. The message requesting the transmission of the remaining fragment files may contain identification information for identifying itself on the network, file identification information of the corresponding file, and information indicating an ordinal number of the fragment file requested to be transmitted, as described with reference toFIG. 3.

In step507, the user terminal secures a storage area for receiving the remaining fragment files. For example, when the remaining fragment files are received but cannot be stored because the user terminal stores fragment files divided from other various files, the user terminal can delete the fragment files divided from other various files. Alternatively, although the user terminal has a sufficient storage area to receive and store the remaining fragment files, the user terminal may secure the storage area for the remaining fragment files in order to prevent a case where the storage area becomes insufficient for storage because fragment files divided from another file are stored before the remaining fragment files are stored. Securing the storage area may be achieved by predicting sizes of the remaining fragment files. For example, as described above with reference toFIG. 3, the file division information may contain information on the size of the corresponding file and information on the size of the corresponding fragment file, so that the user terminal can secure the storage area using such information. In addition, step507may be omitted.

In step509, the user terminal receives the remaining fragment files from another peer terminal and then stores the received remaining fragment files, and reconstructs the file with reference to the file division information. As described above with reference toFIG. 3, the file division information contains the file identification information for identifying the corresponding file, the information indicating the number of fragment files divided from the corresponding file, and the information indicating the ordinal number of the corresponding fragment file, so that the user terminal can reconstruct the original file using such information.

FIG. 6is a flowchart describing the file sharing method from the viewpoint of the terminal having received the request for the transmission of the fragment file from the peer terminal according to an embodiment of the present invention.

When there is the request for the transmission of the fragment file from the peer terminal in step601, the user terminal proceeds to step603. The request for the transmission may contain identification information for identifying the peer terminal on the network and information indicating an ordinal number of the fragment file requested to be transmitted.

The user terminal searches whether the corresponding fragment file is stored in step603. When the corresponding file is stored, the user terminal proceeds to step605. Otherwise, the user terminal proceeds to step607.

In step605, the user terminal transmits the requested fragment file to the peer terminal having made the request, after determining that the requested fragment file is stored.

Meanwhile, in step606, the user terminal transmits a message informing that there is no corresponding fragment file to the peer terminal, after determining that the requested fragment file is not stored.

Hereinafter, a method of, when the terminal having made the request for the transmission of the fragment file does not receive some of the fragment files, finding the fragment file which is not received will be described.

When the user terminal does not receive some of the fragment files after making the request for the transmission of the fragment file, the user terminal may use a Distributed Hash Table (DHT) scheme or a Prefix Hash Table (PHT) scheme to find the fragment file which is not received (hereinafter, referred to as a particular fragment file). To this end, it is assumed that all terminals located on the network build and manage a Hash table. A message making a request for transmission of the particular fragment file is transmitted from one terminal to another terminal according to the DHT scheme or the PHT scheme, and accordingly the user terminal can find the terminal storing the particular fragment file. Meanwhile, when the terminals located on the network use a Global Positioning System (GPS), the user terminal can detect a position of the terminal storing the particular fragment file and accordingly guide the user to a receivable position of the particular fragment file. That is, the user terminal receives GPS information of the terminal storing the particular fragment file, detects the position of the corresponding terminal by using the GPS information, and then guides the position of the corresponding terminal to the user.

Further, the user terminal can guide a position where the user was located in the past among receivable positions of the particular fragment file based on a past movement history of the user terminal to the user of the user terminal. To this end, it is assumed that the terminals located on the network periodically store their movement positions.

FIG. 7is a block diagram describing a file sharing apparatus according to an embodiment of the present invention.

Referring toFIG. 7, the file sharing apparatus according to an embodiment of the present invention includes a controller710, a transceiver720, a memory unit730, and a display unit740.

The controller710divides a file allowed to be shared and generates at least two fragment files. The controller710can divide the file allowed to be shared based on the number of peer terminals. Further, the controller710generates file division information used for reconstructing the file allowed to be shared by using the divided fragment files, and combines the generated file division information with each of the fragment files.

After receiving one fragment file from the peer terminal, when a network is changed, the controller710can transmit the received fragment file to at least one peer terminal located on the changed network.

Furthermore, the controller710determines whether the file allowed to be shared belongs to a set category with reference to the file division information combined with the fragment file. When the file allowed to be shared is the file belonging to the set category, the controller710transmits a message making a request for transmission of the remaining fragment files divided from the file allowed to be shared to at least one peer terminal At this time, the controller710guides a position of another terminal, to the user, based on information on the position of another terminal storing at least one fragment file among the remaining fragment files received from the peer terminal. The guiding may be performed by an image output through the display unit740. The controller710may guide, to the user, a position of another terminal corresponding to its own past position based on past positions stored in the memory unit730.

The transceiver720transmits the fragment files combined with the file division information to the peer terminal, or receives the fragment files from the peer terminal. At this time, the transceiver720can transmit one fragment file to one peer terminal.

The memory unit730stores the file allowed to be shared or the fragment file to be shared. Also, the memory unit730periodically stores its own position.

The above described embodiments of the present invention may be implemented in various ways. For example, the embodiments of the present invention may be implemented by hardware, software, or a combination thereof. In an implementation by software, the embodiments of the present invention may be implemented by software executed on one or more processors using various operating systems or platforms. In addition, such software may be made using any of a plurality of suitable programming languages, and complied by an executable machine language code executed in a framework or a virtual machine or an intermediate code.

Further, when the embodiments of the present invention are executed on one or more processors, the embodiments of the present invention may be implemented by one or more processor-readable media (for example, a memory, a floppy disk, a hard disk, a compact disk, an optical disk, a magnetic tape, or the like) recording one or more programs for performing the method of implementing the above described embodiments of the present invention.

According to the present invention, it is possible to more actively share a file by automatically transmitting the file between terminals without intervention of a user. The present invention may be applied to a terminal moving between different networks, and as a result, has an advantage of sharing the file between different networks.

While the present invention has been shown and described with reference to certain embodiments thereof, it will be understood by those skilled in the art that various changes in form and details may be made therein without departing from the spirit and scope of the present invention. Therefore, the spirit and scope of the present invention is not limited to the described embodiments thereof, but are defined by the appended claims and equivalents thereof.