The subject matter which is regarded as the invention is particularly pointed out and distinctly claimed in the claims at the conclusion of the specification. The foregoing and other objects, features, and advantages of the invention are apparent from the following detailed description taken in conjunction with the accompanying drawings in which:
The detailed description explains the preferred embodiments of the invention, together with advantages and features, by way of example with reference to the drawings.
An embodiment of this invention will reduce the amount of constant TCP connections that must be maintained to support sending information to the device. An embodiment of the invention will dynamically detect whether or not a NAT or firewall has created a difficulty in establishing a connection with the device, and use the best TCP connection strategy based on that dynamic detection. This provides support for TCP connection in all environments, maximizes the resource utilization, and minimizes the number of sockets committed to constant connections.
Referring now to
While an embodiment of the invention has been shown having a single network 175 connected to the server 150 via a wire, it will be appreciated that the scope of the invention is not so limited, and that the invention will also apply to other methods of transmitting data, such as a radio frequency or infra-red wireless network, for example, and that the server may be in data communication with additional devices, such as servers, workstations, and mobile devices, through additional networks, for example.
In an embodiment, the device 125 is configured to determine a connection status of the network 175. In an embodiment, the server 150 is configured to open the socket listener 152 and to listen for connections initiated from the device 125. In an embodiment, the device 125 is configured to open the socket listener 127 and also initiate a first connection through the network 175 to the socket listener 152 of the server 150, the first connection configured to instruct the server 150 to attempt to establish a second connection through the network 175 to the socket listener 127 of the device 125.
In response to a successful attempt to establish the second connection, the device 125 is configured to close the first and second connection, and to keep the socket listener 127 open, the socket listener 127 awaiting subsequent external requests for communication. In an embodiment, verification of the successful attempt to initiate the second connection originating from the server 150 will eliminate the need to keep a constant connection active in order for the device 125 to receive data from the server 150 in the absence of a request from the device 125. Accordingly the first and second connections are closed.
In an embodiment, in response to a failed attempt to establish the second connection, the server 150 is configured to send a second message to the device 125 via the first connection. In response to receiving the second message from the server 150, the device 125 is configured to keep the first connection open and close the socket listener 127. In an embodiment, keeping the first connection open, in response to the failure of the attempt to establish the second connection originating from the server 150, will enable the server 150 to send data to the device 125 at will, or, in the absence of a request from the device 125.
Difficulties associated with the attempt to establish the connection initiated by the server 150 through the network 175 to the device 125 are often related to the effects of a firewall or a NAT on the network 175. In an embodiment, the device 125 is configured to determine the effects of at least one of a firewall and a network address translation between the device 125 and the server 150.
In view of the foregoing, the network communication system 100 performs the method of optimizing the network connection between the device 125 and the server 150. Referring now to
The method begins with opening 210 the socket listener 127 on the device 125 to listen for connections, and initiating 220 the first connection from the device 125 to the server 150 through the network 175. Following the initiation 220 of the first connection, the method proceeds with sending 230 a first message from the device 125 via the first connection, the first message instructing the server 150 to attempt to establish the second connection through the network 175 to the socket listener 127 of the device 125. In an embodiment, the method further comprises opening the socket listener 152 on the server 150 to listen for connections from the device 125.
In an embodiment, the device 125 is a mobile device. In an embodiment, subsequent to sending 230 the first message, the server 150 continues by attempting 240 to establish the second connection from the server 150 to the socket listener 127 of the device 125. The method proceeds with the device 125 determining 250 the network status based upon the success of the attempt to establish the second connection.
In an embodiment, in response to a successful attempt to establish the second connection, the method proceeds with closing 260 the first and second connection and maintaining the open socket listener 127 to monitor for subsequent requests originating from the server 150 to establish a connection, without the need to maintain a constant, active connection between the device 125 and the server 150.
In an embodiment, in response to a failed attempt to establish the second connection, the method continues by sending 270 the second message from the server 150 to the device 125 via the first connection, and subsequent to the device 125 receiving the second message, closing 280 the socket listener 127 and keeping the first connection open between the device 125 and the server 150. There is no reason to keep the socket listener 127 open, as the failure to establish the second connection has demonstrated that the difficulty present within the network 175 will prevent any requests originating from the server 150 to establish a connection between the server 150 and the device 125. Accordingly, maintenance of the first active connection will allow the server 150 to subsequently send data to the device 125 at will, or, without the request from the device 125 to the server 150 for the data.
In an embodiment, the opening 210 a socket listener 127 comprises opening a TCP socket listener 127. In an embodiment, the determining 250 the network 175 status comprises determining 250 the effects of at least one firewall or network address translation between the device 125 and the server 150.
The capabilities of the present invention can be implemented in software, firmware, hardware or some combination thereof.
As one example, one or more aspects of the present invention can be included in an article of manufacture (e.g., one or more computer program products) having, for instance, computer usable media. The media has embodied therein, for instance, computer readable program code means for providing and facilitating the capabilities of the present invention. The article of manufacture can be included as a part of a computer system or sold separately.
Additionally, at least one program storage device readable by a machine, tangibly embodying at least one program of instructions executable by the machine to perform the capabilities of the present invention can be provided.
The flow diagrams depicted herein are just examples. There may be many variations to these diagrams or the steps (or operations) described therein without departing from the spirit of the invention. For instance, the steps may be performed in a differing order, or steps may be added, deleted or modified. All of these variations are considered a part of the claimed invention.
While the preferred embodiment to the invention has been described, it will be understood that those skilled in the art, both now and in the future, may make various improvements and enhancements which fall within the scope of the claims which follow. These claims should be construed to maintain the proper protection for the invention first described.