To make the objects, technical solutions and advantages of the present invention apparent, the present invention will be further described in detail by referring to the drawings and the illustrated embodiments.
In the method for data transmission in devices in a network according to the present invention, a pipe control module is provided in each of the network devices, and the pipe control modules of a source device for data transmission and a target device for data transmission in one and the same network respectively encapsulate different media network connection manners available for both the source device and the target device into a data transmission pipe, according to operating conditions of the devices, and create the data transmission pipe between the source device and the target device; one media network connection manner out of the data transmission pipe is selected to perform data transmission; and when it is necessary to switch to another media network connection manner during the data transmission, the pipe control module of the source device controls to create a new media network connection to continue the data transmission.
In the present invention, the different media network connection manners available for both the source device and the target device are encapsulated into the data transmission pipe, and there are two implementations for creating the data transmission pipe between the source device and the target device:
The first implementation comprises the steps of:
11) acquiring, by the pipe control modules of the source device for data transmission and the target device for data transmission in one and the same network, the different media network connection manners available for the counter-party by means of sensing a network multicast address;
12) selecting, by the source device, one available media network connection manner to create a network protocol connection with the target device;
13) sending, by the pipe control module of the source device, a data transmission pipe creation request to the target device via the network protocol connection created in the step 12);
14) determining, by the pipe control module of the target device, whether the creation of the data transmission pipe is agreed or not, according to its operating conditions, and then returning a data transmission pipe creation response to the source device; if the target device agrees on the creation of the data transmission pipe, encapsulating the different media network connection manners available for both the source device and the target device into the data transmission pipe; and
15) judging, by the pipe control module of the source device, whether the target device agrees to create the data transmission pipe or not according to the data transmission pipe creation response returned by the target device; if yes, encapsulating the different media network connection manners available for both the source device and the target device into the data transmission pipe, and the data transmission pipe creation being successful; otherwise, the data transmission pipe creation fails.
The second implementation comprises steps of:
11
a) creating, by the source device, a network protocol connection with the target device by using a network protocol of the network in which the source device is located;
12
a) sending, by the pipe control module of the source device, a data transmission pipe creation request to the target device via the network protocol connection created in the step 11a), the request containing different media network connection manners available for the source device itself;
13
a) determining, by the pipe control module of the target device, whether the creation of the data transmission pipe is agreed or not, according to its operating conditions; if the creation of the data transmission pipe is agreed, encapsulating the different media network connection manners available for both itself and the counter-party into the data transmission pipe, and containing different media network connection manners available for the target device itself in the data transmission pipe creation response;
returning, by the target device, the response to the source device;
14
b) judging, by the pipe control module of the source device, whether the target device agrees to create the data transmission pipe or not according to the data transmission pipe creation response returned by the target device; if yes, encapsulating the different media network connection manners available for the source device itself and the different media network connection manners available for the counter-party contained in the response into the data transmission pipe, and the data transmission pipe creation being successful; otherwise, the data transmission pipe creation fails.
In the above two implementations, the encapsulating method of the data transmission pipe may be as follows: the pipe control modules of the source device and the target device respectively fill the different media network connection manners available for both the source device and the target device into pipe information tables within the respective devices to which they respectively belong, and the pipe information table is usable for subsequent searches. Particularly, the pipe control module generates information on the different media network connection manners available for both the source device and the target device at the present time, and judges whether a pipe information table exists or not in the device to which the pipe control module belongs; if not, creates a pipe information table, and adds the generated information into the pipe information table; if yes, directly adds the generated information into the pipe information table; wherein, the information on the different media network connection manners available for both the source device and the target device contains a pipe identity, and information on network protocols and connection addresses commonly supported by the piped devices.
The embodiment illustrated in the following is the first implementation as indicated above, that is to say, the pipe control modules of the source device for data transmission and the target device for data transmission in one and the same network acquire the different media network connection manners available for the counter-party by means of sending a network multicast address.
Referring to
Step 101, an application which will transmit data in a source device sends a command to create a pipe to a pipe control module in the source device, and the command to create a pipe contains a device identity of a target device.
Step 102, the pipe control module of the source device controls to create a network connection between the source device and the target device, such as a TCP connection, and sends a pipe creation request message to the target device according to the identity of the target device contained in the command to create a pipe. The pipe creation request message contains a device identity of the source device, the device identity of the target device and an expected time duration of the pipe.
Step 103, a pipe control module of the target device determines whether the creation of the data transmission pipe is agreed or not, according to its operating conditions, and then returns a data transmission pipe creation response message to the source device; if the target device agrees on the creation of the data transmission pipe, the different media network connection manners available for both the source device and the target device are encapsulated into the data transmission pipe, that is to say, information on the different media network connection manners available for both the source device and the target device is filled into a pipe information table. The pipe creation response message contains success or failure information on the pipe creation, and if the pipe creation is successful, the pipe creation response further contains its device identity, the identity of the source device, and a valid period of the pipe.
Step 104, the pipe control module of the source device judges whether the target device agrees to create the data transmission pipe or not according to the data transmission pipe creation response returned by the target device; if yes, the different media network connection manners available for both the source device and the target device are encapsulated into the data transmission pipe, that is to say, information on the different media network connection manners available for both the source device and the target device is filled into a pipe information table, and the data transmission pipe creation is successful; otherwise, the data transmission pipe creation fails. The pipe control module of the source device returns a result of the pipe creation to the application in the source device.
Step 105, the application in the source device sends a command to transmit data to the pipe control module of the source device, in which the command to transmit data contains a pipe identity, the identity of the target device, an identity of a target application, and source data to be transmitted.
Step 106, after receiving the command to transmit data, the pipe control module of the source device selects one media network connection manner out of the data transmission pipe, and sends the data to be transmitted to the pipe control module of the target device. The data to be transmitted contains at least the device identity of the source device, an identity of the application transmitting the data, the identity of the target device, the identity of the target application, and the source data to be transmitted.
Step 107, after receiving the data, the pipe control module of the target device distributes the data to the target application program in the target device according to the identity of the target application in the data.
Step 108, the pipe control module of the source device returns a result indicating whether the data transmission is successful or not to the application in the source device after the data transmission is completed or failed.
Step 109, when the data transmission pipe is idle, the pipe control module of the source device sends a pipe detection request to the target device, in which the pipe detection request contains an expected pipe available period from the source device.
Step 110, after receiving the detection request, the pipe control module of the target device returns a pipe detection response according to its operating conditions, in which the pipe detection response contains a pipe available period, and if the pipe is not available, the pipe control module of the target device can set the pipe available period contained in the pipe detection response into zero.
If the source device does not receive any pipe response or the received pipe response is that the pipe is not available, the pipe control module of the source device deletes the pipe.
Step 111, the application in the source device sends a command to close the pipe after the data transmission is completed, in which the command contains the identity of the pipe to be closed.
Step 112, after receiving the command to close the pipe, the pipe control module of the source device deletes the data transmission pipe according to the identity of the pipe therein, and sends a pipe close notification to the target device. After receiving the close notification, the target device deletes the data transmission pipe.
Step 113, after deleting the data transmission pipe, the pipe control module of the source device returns a result indicating whether the pipe closure is successful or not to the application sending the command to close the pipe.
In the present embodiment, step 102-step 104 are the procedures for creating the data transmission pipe, and the detailed processing of the pipe control module of the source device in such procedure is shown in
Step 201, after receiving a command to create a pipe, the pipe control module of the source device judges whether a data transmission pipe between the source device and the target device exists or not, if yes, the procedure goes to step 207; otherwise, the procedure goes to step 202.
Step 202, the pipe control module of the source device selects one available media network connection manner to create a network protocol connection with the target device, such as a TCP connection.
Step 203, it is judged whether the TCP connection is successful or not, and if yes, the procedure goes to step 204; otherwise, the procedure goes to step 208.
Step 204, the pipe control module of the source device sends a pipe creation request to the target device via the TCP connection.
Step 205, it is judged whether a pipe creation success response is received or not, and if yes, the procedure goes to step 206; otherwise, the procedure goes to step 208.
Step 206, a pipe identity is assigned to the successfully created pipe, and corresponding information is added in the pipe information table.
Step 207, a result of the pipe creation is returned to the application, and the pipe creation success information and the pipe identity are reported to the application. The pipe creation procedure is terminated.
Step 208, a result of the pipe creation is returned to the application, and the pipe creation failure information is reported to the application. The pipe creation procedure is terminated.
In the embodiment shown in
Step 301, after receiving a command to transmit data, the pipe control module of the source device judges whether a pipe corresponding to the pipe identity contained in the command exists or not, if yes, the procedure goes to step 302; otherwise, the procedure goes to step 310.
Step 302, it is judged whether an available network protocol connection exists at present, if yes, the procedure goes to step 303; otherwise, the procedure goes to step 305.
Step 303, the traffic amount waiting to be transmitted on the available network protocol connection and the average speed for transmitting data on the network protocol connection are determined, if the traffic amount waiting to be transmitted is too large or the average speed for transmitting data on the network connection is too low, the procedure goes to step 304; otherwise, the procedure goes to step 307.
Step 304, it is searched and judged whether other available network protocol connection exists or not at present, if yes, the procedure returns to step 303; otherwise, the procedure goes to step 305.
Step 305, a network protocol commonly matched between the source device and the target device is selected to attempt to create a new network protocol connection.
Step 306, it is judged whether the creation of the new network protocol connection is successful or not, if yes, the procedure goes to step 307; otherwise, the procedure goes to step 310.
Step 307, the data to be transmitted is put into a task queue of the currently available network protocol connection, and the data is transmitted.
Step 308, it is judged whether the transmission is successful or not, if yes, the procedure goes to step 309; otherwise, the procedure goes to step 310.
Step 309, a result of the data transmission is returned to the application, and it is reported that the data transmission is successful. The data transmission procedure is terminated.
Step 310, a result of the data transmission is returned to the application. And it is reported that the data transmission is erroneous as well as the error causes. The data transmission procedure is terminated.
In the above procedures, if the recreation of the network protocol connection is not successful because the traffic amount waiting to be transmitted is too large or the average speed of transmitting data on the network connection is too low, the original network protocol connection can also be used for data transmission but the efficiency of the transmission is low.
If the network protocol connection for transmitting the data is disconnected in the course of data transmission due to external factors, the pipe control module of the source device selects a new media network connection manner out of the data transmission pipe to create a network protocol connection. If the creation is successful, the new network protocol connection is used to continue the data transmission and the source device is notified; otherwise, the source device is notified that the data transmission is erroneous and the data transmission pipe is not available.
The pipe control module in the present embodiment may be provided with a pipe creation interface, a data transmission interface, a pipe detection interface and a pipe close interface. The source device may achieve the functions of pipe creation, data transmission, pipe detection, pipe closure and the like by invoking these interfaces of the pipe control module.
Additionally, if the source device in the present embodiment wants to perform data transmission with multiple target devices, the source device can respectively create the data transmission pipes with the multiple target devices through the pipe control module with the same method for creating a data transmission pipe but with different interfaces used by respective data transmission pipes. For example, it is assumed that the source device only has one Bluetooth port. If this port has been encapsulated into one data transmission pipe with a target device 1, this port cannot be encapsulated into a data transmission pipe between the source device and a target device 2.
It is assumed that in the embodiment shown in
Respectively through the sensing port 1234 and the sensing port 2345, the laptop computer 1 and the laptop computer 2 respectively sense different media network connection manners available to the counter-party which are sent from the counter-party to a network multicast address.
As such, a procedure of transmitting data from the FC on the laptop computer 1 to the Fs on the laptop computer 2 may include the followings.
1. The Fc on the laptop computer 1 sends a command to create a pipe to the pipe control module 1.
2. The pipe control module 1 selects one media network connection manner available for both the laptop computer 1 and the laptop computer 2 to create a network protocol connection. In the present embodiment, the TCP/IP protocol is selected to create a TCP connection between the laptop computer 1 and the laptop computer 2.
3. The pipe control module 1 sends a pipe creation request message to the laptop computer 2 though the created TCP connection. The pipe creation request message is shown as Table 1.
4. After receiving the pipe creation request message, the channel control module 2 of the laptop computer 2 accepts the pipe creation request according to current operating conditions of the laptop computer 2, and sends a pipe creation response message to the laptop computer 1. The pipe creation response message is shown as Table 2.
If the channel control module 2 of the laptop computer 2 does not accept the pipe creation request, the value of the message field “ResultCode” shown in Table 2 will be “Failure”.
5. After receiving the pipe creation response message, the software module on the laptop computer 1 reports a success or failure result of the pipe creation to the program Fc. Once receiving the result report of the successful pipe creation, the Fc may transmit data to the Fs via this pipe. The data transmission message is shown as Table 3.
In which, “Data” field can be the source data packaged in other formats.
In the present embodiment, if the application Fc on the laptop computer 1 sends data to the Fs in a large quantity, the software module on the laptop computer 1 may fulfill the data transmission requirements by creating a new TCP connection. At this time, a channel information table is shown as Table 4.
If these two TCP connections are disconnected due to external factors in the course of data transmission, the channel control module 1 of the laptop computer 1 records a position of the current data transmission, and selects Serial Port: 2 out of the data transmission pipe to attempt to connect, and if the connection is successfully created, the channel control module 1 of the laptop computer 1 continues the data transmission through Serial Port: 2 according to the recorded data position. If the creation of connection fails, the channel control module notifies the Fc that the data transmission is erroneous and the current pipe is not available.
During a pipe idle period in which both the laptop computer 1 and the laptop computer 2 have finished the transmission of the data to be transmitted, the channel control module 1 of the laptop computer 1 may regularly sends a pipe detection request message to the laptop computer 2 to detect the availability of the pipe. The pipe detection request message is shown as Table 5.
After receiving the pipe detection request form the laptop computer 1, the channel control module 2 of the laptop computer 2 may send a pipe detection response message according to actual conditions. If the load on the laptop computer 2 is too heavy, the channel control module 2 of the laptop computer 2 may send a detection response message with a pipe available time of 0. The message is shown as Table 6.
After the pipe creation is successful, the channel control module of the laptop computer 1 or the laptop computer 2 may also send a pipe close notification message to the counter-party to notify the counter-party that the pipe is not available any more, if necessary. The pipe close notification message is shown as Table 7.
The present embodiment is not only applicable to the wireless data transmissions between laptop computers, but also applicable to those between a laptop computer and a mobile phone, between mobile phones, those between a mobile phone and a PDA, those between PDAs, those between a PDA and a laptop computer, and those between various network devices. Of course, the present invention is also applicable to the wired data transmission between network devices on a wired network.
According to the above embodiments, the method for data transmission between network devices of the present invention can automatically select an available connection manner to perform data transmission in the course of transmitting data, and thus facilitates the users and saves the system resources.
Number | Date | Country | Kind |
---|---|---|---|
200410062649.2 | Jun 2004 | CN | national |
Filing Document | Filing Date | Country | Kind | 371c Date |
---|---|---|---|---|
PCT/CN04/01348 | 11/24/2004 | WO | 00 | 12/29/2006 |