Skype is an immensely popular P2P application, often with seven or eight million users connected to it at any one time. In addition to providing PC-to-PC Internet telephony service, Skype offers PC-to-phone telephony service, phone-to-PC telephony service, and PC-to-PC video conferencing service.
Skype uses P2P techniques in a number of innovative ways, nicely illustrating how P2P can be used in applications that go beyond content distribution and file sharing. As with instant messaging, PC-to-PC Internet telephony is inherently P2P since, at the heart of the application, pairs of users (i.e., peers) communicate with each other in real time. But Skype also employs P2P techniques for two other important functions, namely, for user location and for NAT traversal.
Skype includes an index that maps Skype usernames to current IP addresses (and port numbers). This index is distributed over the super peers. When Alice wants to call Bob, her Skype client searches the distributed index to determine Bob’s current IP address. Because the Skype protocol is proprietary, it is currently not clear how the index mappings are organized across the super peers, although some form of DHT organization is very possible.
P2P techniques are also used in Skype relays, which are useful for establishing calls between hosts in home networks. Many home network configurations provide access to the Internet through a router (typically a wireless router). These routers are actually more than routers, and typically include a so-called Network Address Translator (NAT). For now, all we need to know is that a NAT prevents a host from outside the home network from initiating a connection to a host within the home network. If both Skype callers have NATs, then there is a problem—neither can accept a call initiated by the other, making a call seemingly impossible. The clever use of super peers and relays nicely solves this problem. Suppose that when Alice signs in, she is assigned a non-NATed super peer. Alice can initiate a session to her super peer since her NAT only disallows sessions initiated from outside her home network. This allows Alice and her super peer to exchange control messages over this session. The same happens for Bob when he signs in. Now, when Alice wants to call Bob, she informs her super peer, who in turn informs Bob’s super peer, who in turn informs Bob of Alice’s incoming call. If Bob accepts the call, the two super peers select a third non-NATed super peer—the relay node— whose job will be to relay data between Alice and Bob. Alice’s and Bob’s super peers then instruct Alice and Bob respectively to initiate a session with the relay. Alice then sends voice packets to the relay over the Alice-to-relay connection (which was initiated by Alice), and the relay then forwards these packets over the relay-to-Bob connection (which was initiated by Bob); packets from Bob to Alice flow over these same two relay connections in reverse. Bob and Alice have an on-demand end-to-end connection even though neither can accept a session originating from outside its LAN. The use of relays illustrates the increasingly sophisticated design of P2P systems, where peers perform core system services for others (index service and relaying being two examples) while at the same time themselves using the end-user service (e.g., file download, IP telephony) being provided by the P2P system.