Patent ID: 8499083

Claim:
A first relay device capable of communicating with a first communication device connected to a first local area network (LAN) and a second communication device connected to the first LAN, a server device connected to a wide area network (WAN), a second relay device connected to the WAN and a second LAN, the first relay device comprising: a holding unit for establishing and holding a transmission control protocol (TCP) relay connection with the second relay device by inquiring of the server device as to a connection status of the second relay device and transmitting a request for connecting the second relay device to the server device when being notified by the server device that the second relay device has logged into the server device; a storing unit for storing connection information in which the second relay device, the first communication device and the TCP relay connection held in the holding unit are associated with each other, and for storing connection information in which the second relay device, the second communication device and the TCP relay connection held in the holding unit are associated with each other; a determining unit for determining whether a TCP relay connection associated at least with the second relay device has been held or not based on data, which is received from the first communication device, designating the second relay device, and the connection information stored in the storing unit; a relay connection controlling unit, when the first relay device receives data designating the second relay device from the first communication device, for transmitting the data to the second relay device via the TCP relay connection held in the holding unit where the determining unit determines that a TCP relay connection associated at least with the second relay device has been held, and, when the first relay device receives data designating the second relay device from the second communication device, for transmitting the data to the second relay device using the same TCP relay connection used by the first communication device to transmit data to the second relay device, and for transmitting the data to the second relay device via a new TCP relay connection which the holding unit is directed to dynamically establish with the second relay device and to hold where the determining unit determines that a relay connection associated at least with the second relay device is yet to be held; and an updating unit for updating connection information stored in the storing unit.