Abstract:
During communication of a large data message from a client application to a server application, requirements to communicate smaller control messages can arise. To facilitate timely communication of control messages, a client application may include a chunking module that divides a data message into chunks that can be sent as a sequence of individual data message packets. When a control message needs to be sent, the sequence of data message packets can be interrupted to send a control message packet. At the server application, the sequence of message packets is processed so that data message packets are appended to a data message and control messages are extracted for immediate processing.

Description:
FIELD OF THE INVENTION 
     This disclosure relates to data communication protocols and in particular, though not exclusively, to data communication between networked applications. 
     BACKGROUND OF THE INVENTION 
     Modern networked applications have increasing needs for data communication on the network. Generally, this data falls into two categories: (1) small control messages such as web browser requests or remote procedure calls; and (2) large data messages such as video files and other multimedia documents. Communication between two networked applications takes place over a network connection. A problem arises when an application needs to send a small data message while the network connection is being used to send a large message such as an 8 mega-pixel image, especially when transfer of the small data message is time-sensitive. 
     One existing solution to this problem is for the application to use two network connections: one for small control messages, and the other for large data messages. This solution is employed by the FTP (File Transfer Protocol) standard. The drawback with this solution is in the overhead and inefficiency of using a second network connection. Control messages are typically sent infrequently, resulting in the second network connection being under-utilized. A second solution is for the application to wait for the large message to be sent, and then send the smaller control message. While this is acceptable for some application needs, if the control message is time-sensitive this solution is inadequate. 
     SUMMARY OF THE INVENTION 
     To facilitate timely communication of control messages, a client application may include a chunking module that divides a data message into chunks that can be sent as a sequence of individual data message packets. When a control message needs to be sent, the sequence of data message packets can be interrupted to send a control message packet. At the server application, the sequence of message packets is processed so that data message packets are appended to a data message and control messages are extracted for immediate processing. 
     In one aspect of the disclosure, there is provided a method for communication between a client device and a server device. The method may comprise determining a need in the client device to send a data message from the client device to the server device. The data message may be divided into chunks in the client device and sequentially sent from the client device to the server device. During the sending of the chunks, a control message may be sent from the client device to the server device between chunks of the data message. 
     In one aspect of the disclosure, there is provided a method for receiving communications into a server application of a server device from a client application of a client device. The method may comprise receiving a message packet into the server application of the server device and determining in the server application whether the message packet is a data message packet or a control message packet. If the message packet is a control message packet, the control message packet may be processed to perform a control operation indicated by the control message packet. If the message packet is a data message packet, data of the data message packet may be appended to a data message at the server application. 
     In one aspect of the disclosure, there is provided a system comprising a client application executing on a client device and a server application executing on a server device in which the client application and the server application are configured to communicate with each other. The client application may comprise a client chunking module configured to generate a sequence of message packets for a data message and to intersperse one or more control message packets into the sequence of message packets. The server application may comprise a server chunking module and a server data transfer module. The server chunking module may be configured to receive the sequence of message packets from the client application, process the sequence of message packets to reconstitute a data message, and extract a control message from the sequence of message packets. The server data transfer module may be configured to receive a control message from the server chunking module, and enact a control operation indicated by the control message while the data message is being received from the client application. 
    
    
     
       BRIEF DESCRIPTION OF THE DRAWINGS 
       Reference will now be made, by way of example only, to specific embodiments and to the accompanying drawings in which: 
         FIG. 1  shows a system for communication between a client application and a server application; 
         FIG. 2  depicts a method for communicating between the client application and the server application; 
         FIG. 3  depicts a method for interspersing control message packets between data message packets; and 
         FIG. 4  depicts a method for reconstituting a data message while allowing real-time processing of control messages. 
     
    
    
     DETAILED DESCRIPTION OF THE INVENTION 
     In  FIG. 1 , there is shown a system  10  on which the network communications methods may be utilized. The system  10  includes a first and second mobile applications executing on mobile devices. A first application may act as a client application  12  (communication source) to the second application that acts as a server application  22  (communication destination), though the choice of client and server may change depending on context. In one implementation, the client application and server application may each be mobile applications executing on respective mobile devices. Alternatively, one or both of the client and server may be executing on fixed devices. 
     The client application  12  sends both small control messages and large data messages and the server application  22  receives and operates on the control and data messages. 
     The essence of the system  10  is to transfer any smaller control messages while the large data message is being transferred. An embodiment of the procedure is depicted in the flowchart  100  of  FIG. 2 . At step  101 , the client application determines a need to send a data message from the client device to a server device. At step  102 , the client application divides the large data message into chunks of a determined size. The client application then sequentially sends each chunk of the data message in an individual data packet to the server application  22  (step  103 ). During the sending of the chunks, the client application determines a need to send a control message from the client device to the server device (step  104 ). The client application has the opportunity to send a control message before each data message chunk is transferred (step  105 ). 
     Each of the client application  12  and server application  22  includes a data transfer module  14 ,  24  that operates to send and receive messages. Each of the client application  12  and server application  22  also includes a chunking module  16 ,  26  that, on a client, operates to split a large message into smaller pieces (“chunks”) and send the chunks as data packets, and on a server operates to receive the data packets and to reconstitute the chunks into the full message. 
     The client application  12  opens a network connection to a server application  22 . The client application  12  initiates transfer of a large data message such as a video file/stream, archive, log file, etc. using the client data transfer module  14 . During transfer of the large data message, the application also sends one or more control messages using the client data transfer module  14 . The client data transfer module  14  sends the data message and control messages to the server chunking module using the client chunking module  16 . The client chunking module  16  sends the data message in pieces (“chunks”). When the application sends a control message, the client chunking module  16  sends the control message to the server chunking module  26  in between chunks of the data message. The client chunking module determines how many bytes will be sent in each chunk. The client chunking module  16  encodes each chunk and control message into a messaging packet using a messaging protocol understood by it and the server chunking module  26 . 
     The server chunking module  26  receives data message chunks and control messages  15 . It reconstitutes the data message chunks into the data message. It passes both the data message and control messages to the server data transfer module  24 , which pass them to the server application  22 . 
     An example of the process undertaken by the client application  12  is depicted in the flowchart  200  of  FIG. 3 . At step  201 , the client application opens a network connection to the server application  22 . The client chunking module  16  receives a data message from the data transfer module  14  (step  202 ) and initiates the transfer of the data message  203 . To transfer the message, the client chunking module  16  creates a data message packet  204  and sends the packet  205  on the open network connection to the server chunking module  26 . 
     After sending a packet of the data message, the chunking module determines whether there is a control message to be sent to the server application  206 . In one embodiment, the data transfer module  14  provides an interrupt or similar signal to the client chunking module  16  whenever the client application requires a control message to be sent. The client chunking module  16  listens for interrupts between sending data packets. In another embodiment, the data transfer module adds the control message to a queue in the client chunking module whenever the client application requires a control message to be sent. The client chunking module checks its queue for control messages between sending data packets, and if there are any control messages in its queue it will send those before resuming sending data packets. 
     If a control message is to be interspersed into the sequence of data message packets, the client chunking module  16  receives the details of the control message from the client data transfer module  14  and sends a control message packet to the server chunking module  26  on the same open network connection (step  207 ) that is being used to send the data message packets. 
     If at step  206 , the chunking module determines that there is no control message to be sent, the process proceeds to step  208  in which the client chunking module  16  determines if the last data packet of the data message has been sent. If not, the process returns to step  204  to create the next data message packet. If the last data packet has been sent, the client chunking module  16  creates and sends a “transfer complete” packet to the server chunking module  26  (step  209 ) indicating that transmission of the data message is complete. 
     An example of the process undertaken by the server application  22  is depicted in the flowchart  300  of  FIG. 4 . At step  301 , the server application  22  establishes the network connection with the client application  12  and then receives a packet into the server chunking module  26  (step  302 ). The server chunking module  26  then determines whether the packet is a control message packet or a data message packet (determination  303 ). If the message packet is a control message, the chunking module  26  passes the control message to the server data transfer module  24  (step  304 ) which can then ensure that any control operation specified in the control message packet is performed. The process then returns to step  302  to receive the next message packet. If the determination  303  determines that the message packet is a data message packet, the process then determines if the data message packet indicates completion of a data message transfer. If not, then the server chunking module  26  decodes the data packet (step  306 ) and appends the data chunk to a data message that is assembled, chunk by chunk, in a data message buffer (step  307 ). If step  305  determines that the data message transfer is complete, the chunking module  26  passes the entire data message buffer to the data transfer module (step  308 ) so that the server application may process the complete data message as appropriate, including performing any subsequent operations on the complete data message, such as storing the data in a database, analyzing the data, etc. The process then returns to step  302  to receive any further message packets. Alternatively, the network connection may be closed. 
     The client chunking module  16  and server chunking module  26  may communicate using a common messaging protocol. The protocol specifies, for each messaging packet:
         1. Whether the packet is a control message or a data message chunk;   2. The size of the packet payload;   3. A unique identifier for the message;   4. An identifier for the chunk;   5. The payload.       

     When sending a data message, each chunk receives an identifier assigned by the client chunking module  16 , beginning with 1 and incrementing by 1 for each subsequent chunk. The chunk identifier is used by the server chunking module  26  to reconstitute the data message correctly if a chunk is received out-of-order. 
     The server chunking module  26  may send a message acknowledging receipt of each packet to the client chunking module  16 . If there is any error in receiving a portion of a message, the server chunking module  26  may send a request to the client chunking module  16  to re-send a specified chunk. 
     The server chunking module  26  may send a request to stop transfer of a specified data message to the client chunking module  16 , for example, if the server chunking module has encountered an unrecoverable error in reconstituting the data message, or based on one or more control messages at the server application. The client chunking module  16  may send a message to the server chunking module  26  indicating that it is aborting transfer of a specified data message. 
     The client chunking module and server chunking module may determine cooperatively the size of each chunk prior to initiating the transfer of the data message. For example, the client chunking module  16  may change the size of chunks based on application requirements, network performance, or other parameters. Conversely, the server chunking module  26  may request that the client chunking module  16  change the size of chunks based on application requirements, network performance, or other parameters. 
     The chunking modules are operable to support transferring multiple data messages in parallel. Each data message has a unique identifier which allows the server chunking module to resolve each chunk into the appropriate data message. 
     The message communication protocols described above may be implemented and employed directly within a single networked software application, or be packaged as part of a software library to be utilized by a multiplicity of networked software applications. The library/application may be an object request broker (ORB) or messaging system; a client/server or peer-to-peer file transfer system; a video streaming application; or any other networked application that needs to send control messages while a large data transfer is in progress. 
     The above described methods provide an improvement over standard solutions by utilizing network and operating system resources more efficiently. Using these methods for transferring control messages and large data messages results in efficient usage of network connections while allowing time-sensitive control messages to be sent in a timely fashion. 
     The components of the system  10  may be embodied in hardware, software, firmware or a combination of hardware, software and/or firmware. In a hardware embodiment, the client application and the server application may each be executed on a processor of respective client and server devices. The respective applications may be stored as a set of executable instructions in a memory of the device that is operatively associated with the processor. 
     Although embodiments of the present invention have been illustrated in the accompanied drawings and described in the foregoing description, it will be understood that the invention is not limited to the embodiments disclosed, but is capable of numerous rearrangements, modifications, and substitutions without departing from the spirit of the invention as set forth and defined by the following claims. For example, the capabilities of the invention can be performed fully and/or partially by one or more of the blocks, modules, processors or memories. Also, these capabilities may be performed in the current manner or in a distributed manner and on, or via, any device able to provide and/or receive information. Further, although depicted in a particular manner, various modules or blocks may be repositioned without departing from the scope of the current invention. Still further, although depicted in a particular manner, a greater or lesser number of modules and connections can be utilized with the present invention in order to accomplish the present invention, to provide additional known features to the present invention, and/or to make the present invention more efficient. Also, the information sent between various modules can be sent between the modules via at least one of a data network, the Internet, an Internet Protocol network, a wireless source, and a wired source and via plurality of protocols.