Patent ID: 8200841

Claim:
A terminal device that is connected to an internal network, which is under control of a NAT device connected to an external network, and that is capable of communicating with another terminal device that is connected to another internal network, which is under control of another NAT device that is different to the NAT device, the terminal device comprising: a first communication portion that performs tunneling communication with the other terminal device via a server that is connected to the external network, the server being adapted to realize tunneling communication between the terminal device and the other terminal device by encapsulating and decapsulating packets based on a communication protocol by which the NAT device can transfer the packets; an identification portion that identifies, by communication with a management server that is connected to the external network, type information of at least one of the NAT device and the other NAT device, the type information being classified by a port mapping method; a selection portion that selects, based on the type information identified by the identification portion, from a procedure list stored in storage portion, a start-up procedure that is necessary to start peer to peer (P2P) communication between the terminal device and the other terminal device via the NAT device and the other NAT device; a switching portion that performs communication based on the start-up procedure selected by the selection portion and starts the P2P communication with the other terminal device, and then switches from the tunneling communication to the P2P communication by terminating the tunneling communication being performed by the first communication portion; and a second communication portion that performs the P2P communication with the other terminal device after switching from the tunneling communication to the P2P communication by the switching portion.