Smart data transmission protocol optimized for speed and importance
A method of transmitting data between a first computer and a second computer. The method involves the first computers obtaining data for transmission to the second computer, the data including a first type of data and a second type of data. Each type of data has an associated transmission priority, the first type of data has a receipt requirement and the second type of data does not have a receipt requirement. The method further involves the first computer buffering the obtained data in buffer(s), reading the data from the buffer(s) and transmitting the data to the second computer according to the transmission priorities. For the first type of data, the first computer determine, by reference to an expected acknowledgement message from the second computer, whether the transmitted data has been received by the second computer and, if it is determined not to have been received, retransmitting the data to the second computer.
1. A method of transmitting data between a first computer and a second computer, the method comprising:
obtaining, by the first computer, data for transmission to the second computer, the data comprising at least first data and second data, the first data being of a first type of data and the second data being of a second type of data, each type of data having an associated transmission priority, and the first type of data having a receipt requirement whereby the data is required to be received by the second computer and the second type of data not having a receipt requirement;
buffering the obtained data in one or more buffers;
reading the data from the one or more buffers and transmitting the data to the second computer according to the transmission priorities; and
for only transmitted data having a receipt requirement whereby the data is required to be received by the second computer, determining, by the first computer by reference to an expected acknowledgement message from the second computer, whether the transmitted data has been received by the second computer and, if it is determined not to have been received, retransmitting the data to the second computer,
wherein the method comprises:
obtaining, by the first computer, third data, the third data being of the first type of data;
buffering the third data in the one or more buffers; and
in response to determining that the first data was not received by the second computer:
updating the transmission priority of the first data to a level that is higher than that of the third data; and
retransmitting the first data to the second computer before transmitting the third data to the second computer.
2. The method according to claim 1 , further comprising:
for data having a receipt requirement whereby the data is required to be received by the second computer:
determining that plural elements of data have not been acknowledged by the second computer within a threshold period of time; and
retransmitting the most recently transmitted element of data of the plural elements of data.
3. The method according to claim 1 , further comprising:
for data having a receipt requirement whereby the data is required to be received by the second computer:
sending, by the second computer to the first computer, an acknowledgement message associated with the data.
4. The method according to claim 3 , further comprising:
receiving, from the first computer, an element of data;
determining, by the second computer, that at least one element of data has not been received, wherein the at least one element of data was transmitted before the element of data was transmitted; and
transmitting, to the first computer, an acknowledgement message comprising:
an indication that the element of data has been received; and
an indication that the at least one element of data has not been received.
5. The method according to claim 4 , wherein elements of data are associated with sequence numbers, and wherein:
the indication that the element of data has been received comprises an indication of a sequence number associated with the element of data; and
the indication that the at least one element of data has not been received comprises an indication of sequence numbers associated with the at least one elements of data.
6. The method according to claim 5 , further comprising:
storing, by the first computer:
a list of sequence numbers associated with data being of a type having a receipt requirement whereby the data is required to be received by the second computer; and
for each sequence number in the list of sequence numbers, an associated transmission status of the data.
7. The method according to claim 6 , wherein the associated transmission statuses each indicate, one of:
that the data has not been sent by the first computer;
that the data has been sent by the first computer;
that the data has been sent by the first computer, and has been negatively acknowledged by the second computer; and
that the data has been sent by the first computer, and has been positively acknowledged as being received by the second computer.
8. The method according to claim 5 , further comprising:
storing, by the first computer:
a list of sequence numbers associated with data being of the type not having a receipt requirement; and
for each sequence number in the list of sequence numbers, an associated transmission status of the data.
9. The method according to claim 8 , wherein the associated transmission statuses each indicate, one of:
that the data has not been sent by the first computer; and
that the data has been sent by the first computer.
10. The method according to claim 1 , wherein each type of data is associated with a different range of sequence numbers.
11. The method according to claim 10 , wherein the method further comprises:
receiving, from the first computer, plural elements of data, wherein the plural elements of data:
are a type of data that has a receipt requirement whereby the data is required to be received by the second computer; and
are associated with a range of sequence numbers; and
determining, by the second computer:
that an element of data has not been received based on the range of sequence numbers associated with the plural elements of data; and
that the element of data that has not been received is data having a receipt requirement whereby the data is required to be received by the second computer, based on the type of data of the plural elements of data.
12. The method according to claim 1 , further comprising:
obtaining, by the first computer, fourth data, the fourth data being of a third type of data not having a receipt requirement and having a transmission priority that is the same as a transmission priority associated with the first data;
buffering the fourth data in the one or more buffers; and
transmitting the fourth data to the second computer before transmitting the first data.
13. The method according to claim 1 , wherein the one or more buffers comprise a buffer for each type of data obtained by the first computer, the buffers each having a transmission priority corresponding to that of the type of data being buffered in the buffer.
14. The method according to claim 1 , wherein transmitting the data to the second computer comprises transmitting the data via a single network socket.
15. The method according to claim 1 , wherein transmitting the data to the second computer comprises transmitting the data via a UDP socket.
16. The method according to claim 1 , wherein:
reading the data from the one or more buffers comprises reading the data from the one or more buffers into a master buffer before transmitting the data from the master buffer to the second computer.
17. The method according to claim 16 , wherein elements of data are read into the master buffer at a predefined rate.
18. The method according to claim 17 , further comprising:
transmitting, to the second computer, three or more bandwidth request messages;
receiving, by the second computer, the three or more bandwidth request messages and responsively determining a bandwidth of a connection between the first computer and the second computer;
transmitting, by the second computer to the first computer, a bandwidth estimate message, the bandwidth estimate message indicating the bandwidth determined by the second computer; and
at least one of:
adjusting, by the first computer, the predefined rate based on the bandwidth determined by the second computer; and
adjusting, by the first computer, a threshold number of data elements that can be transmitted to the second computer without requiring acknowledgement.
19. The method according to claim 16 , further comprising:
reading the data from the master buffer and forming a data packet having a payload, the payload comprising the first data and the second data; and
transmitting the data to the second computer comprises transmitting the data packet to the second computer.
20. The method according to claim 16 , further comprising:
after reading the data from the one or more buffers into the master buffer:
for data not having a receipt requirement, removing data from the one or more buffers; and
for data having a receipt requirement whereby the data is required to be received by the second computer, retaining data in the one or more buffers until it is determined that the transmitted data has been received by the second computer.
21. The method according to claim 1 , further comprising, before transmitting the first data and the second data:
sending, by the first computer to all computers in a local area network, a broadcast message;
receiving, by the first computer, a response message from the second computer, the response message indicating at least:
a network address of the second computer; and
a security setting used by the second computer;
wherein the first computer transmits data to the second computer in accordance with the security setting.
22. The method according to claim 1 , further comprising, before transmitting the first data and the second data:
sending, by the first computer, a probe message to the second computer using a preconfigured network address of the second computer;
receiving, by the first computer, a response message from the second computer, the response message indicating:
a security setting used by the second computer;
wherein the first computer transmits data to the second computer in accordance with the security setting.
23. A system comprising at least a first computer and a second computer, the first computer comprising:
memory; and
at least one processor configured to:
obtain data for transmission to the second computer, the data comprising at least first data and second data, the first data being of a first type of data and the second data being of a second type of data, each type of data having an associated transmission priority, and the first type of data having a receipt requirement whereby the data is required to be received by the second computer and the second type of data not having a receipt requirement;
buffer the obtained data in one or more buffers;
read the data from the one or more buffers and transmitting the data to the second computer according to the transmission priorities; and
for only transmitted data having a receipt requirement whereby the data is required to be received by the second computer, determine, by reference to an expected acknowledgement message from the second computer, whether the transmitted data has been received by the second computer and, if it is determined not to have been received, retransmit the data to the second computer obtain third data, the third data being of the first type of data;
buffer the third data in the one or more buffers; and
in response to determining that the first data was not received by the second computer:
update the transmission priority of the first data to a level that is higher than that of the third data; and
retransmit the first data to the second computer before transmitting the third data to the second computer.
24. A system comprising a first computer and a second computer,
wherein the first computer comprises:
first memory; and
a first processor configured to:
obtain data for transmission to the second computer, the data comprising at least first data and second data, the first data being of a first type of data and the second data being of a second type of data, each type of data having an associated transmission priority, and the first type of data having a receipt requirement whereby the data is required to be received by the second computer and the second type of data not having a receipt requirement;
buffer the obtained data in one or more buffers;
read the data from the one or more buffers and transmitting the data to the second computer according to the transmission priorities; and
for only transmitted data having a receipt requirement whereby the data is required to be received by the second computer, determine, by reference to an expected acknowledgement message from the second computer, whether the transmitted data has been received by the second computer and, if it is determined not to have been received, retransmit the data to the second computer;
obtain third data, the third data being of the first type of data;
buffer the third data in the one or more buffers; and
in response to determining that the first data was not received by the second computer:
update the transmission priority of the first data to a level that is higher than that of the third data; and
retransmit the first data to the second computer before transmitting the third data to the second computer
wherein the second computer comprises:
second memory; and
a second processor configured to:
receive, from the first computer, an element of data; and
for data having a receipt requirement whereby the data is required to be received by the second computer:
transmit, to the first computer, an acknowledgement message comprising an indication that the element of data has been received.
25. The system according to claim 24 , wherein the second processor is further configured to:
determine that at least one element of data has not been received, wherein the at least one element of data was transmitted, by the first computer, before the element of data was transmitted by the first computer; and
transmit, to the first computer, the acknowledgement message comprising:
an indication that the at least one element of data has not been received.