Patent ID: 8296437

Claim:
A method carried out at a server to facilitate a connection between a first client and a second client, the server being distinct from the first client and the second client, comprising: receiving, from each client, a local IP address and port number associated with a UDP socket that the client has opened and to which it has bound; instructing each client to use its respective UDP socket to execute a packet exchange protocol, the packet exchange protocol comprising the following sub-steps: sending first messages to each of the first client and the second client, the first messages instructing the first client and the second client to each send second messages to target IP addresses and ports specified by the server, wherein a second message is a packet, wherein, for a respective one of the clients, the target IP addresses and ports specified by the server are associated with at least a first target location and a second target location, wherein each of the first and second target locations has a communication channel to the server over which information about a second message received at the respective target location is forwarded back to the server as a reflection packet, the information including a source address and port of the client as seen by a machine at the target location; receiving the information; based on the information received and the respective client's local IP address and port number associated with the UDP socket, determining an associated Internet access type for each respective client; executing a tunnel setup protocol, the tunnel setup protocol comprising the following sub-steps; for each of the first and second clients, and based on the Internet access type for the respective client as determined by the packet exchange protocol, predicting a port range that the respective client will use to send subsequent messages; and instructing each respective client about the predicted port range of the other client so that the first client and the second client can start exchanging data directly through the tunnel and without passing through the server.