How Skype Works : WylieMac

Tuesday, March 20, 2007

How Skype Works

Skype is a software application that allows you to make free phone calls to more than 75 million people worldwide, and shockingly cheap calls to practically everywhere else on Earth! As a result of that, Skype has become the fastest growing service in the history of the Internet. Recently, the company was acquired by eBay, another step forward towards achieving the final goal of making Skype the world’s largest communication company.

Skype is easy to install and use. It allows its users to make crystal clear calls, regardless of their location, send instant messages, switch seamlessly between text and voice communication, make video calls, conference calls, transfer files, call landlines and cell phones for a fraction of the cost of a traditional call. Skype is truly making a revolution in the way we communicate.

But how does it actually work? This article focuses on describing the Skype network and the technology behind it.

Skype is a type of peer-to-peer Voice-Over-IP client, based on the Kazaa file sharing program. The developers of Skype claim that it provides better voice quality than similar applications like MSN and Yahoo Messenger. It also encrypts calls end-to-end.

There are two types of machines in the Skype network – ordinary host (Skype Client) and Super Node (SN). An ordinary host is the computer of a regular user who has the application installed and connects to the network in order to communicate with other users. The Super Nodes are the end-point of ordinary hosts in the network. In other words, ordinary hosts connect to the Super Nodes. Any computer with a public IP and proper hardware configuration can be a SN. An ordinary host must connect to a super node and must register itself with the Skype login server for a successful login. The Skype login server is the only central unit in the whole network. It stores the usernames and respective passwords of all Skype users. Nslookups have shown that this server is located in Denmark. All Super Nodes connect to the login server in attempt to verify the username password of the client. It stores your Skype Name, your e-mail address, and an encrypted representation of your password.

If you are a regular Skype user, then your computer is considered an ‘ordinary host’ that connects to a Super Node. The Super Nodes are servers, located in different parts of the world. But your Skype client, must know to which SN it has to connect. Therefore, every Skype client (SC) maintains a local table that contains the IPs and corresponding ports of Super Nodes. This is called a host cache and it stored in the Windows Registry of the given SC. So basically, every time you load up Skype, it reads the date from the host cache, takes the first IP and port from there and tries to connect to this SN. If the connection fails for some reason (the SN is offline; it is no longer part of the network, etc) then it reads the next line from the table. In case it fails to connect to any of the IPs listed, the Skype returns a login error upon start-up. Hence, the host cache must contain at least one valid entry in order for the application to connect to the network and work properly. Valid entry means an IP address and port number of an online Super Node. The path to the table in the Windows Registry is HKEY_CURRENT_USER / SOFTWARE / SKYPE / PHONE / LIB / CONNECTION / HOSTCACHE. You can verify that on your computer by opening the Start menu, then click Run and enter ‘regedit’, without the dashes. Of course, the exact path could be different in the next versions of the application.

As a concept, Super Nodes were introduced in the third-generation P2P networks. They allow improved search performance, reduced file-transfer latency, network scalability, and the ability to resume interrupted downloads and simultaneously download segments of one file from multiple peers. Basically, they help ordinary hosts connect to each other and guide efficiently the encrypted network traffic.

Super Nodes are also responsible for the 'Global Indexing'. This technology enables you to search for other users in the network. The company guarantees that it will find a user if he has registered and has logged in during the last 72 hours.

A very interesting moment about the Skype network is that it 'self-modifiable'. If you have the application installed, your computer may turn into a Super Node, without you even knowing it, because those capabilities don't have a noticeable impact on a computer's performance. SNs basically store the addresses of up to several hundred Skype users, without carrying any voice, text or file-transfer data. In that manner, the more Skype users come online, the more super nodes become available to expand the capacity of the network.

Skype routes the traffic intelligently by choosing the optimum data transfer path. Since it uses either TCP or UDP protocol, it breaks the whole data stream into separate packets, which can take different paths to the end destination. The final arrangement is done at the receiving end.

As far as safety and privacy are concerned, Skype uses Advanced Encryption Standard, known as Rijndel, used also by the U.S. Government organizations to protect sensitive data. Skype uses 256-bit encryption.

The programmers of Skype have implemented wideband codecs which allows it to maintain a good sound quality at a bandwidth of 32kb/s and allow frequencies between 5-8,000Hz to pass trough.

Your list of contacts, the application stores in the Windows Registry. This is called the Buddy list and once again, it is digitally encrypted. So, the list is local for every machine, or in other words, it’s not downloaded from the central server.

Let’s briefly describe the tasks of the Skype client. First it connects to the network. It then listens on particular ports for incoming calls, refreshes the host cache table, uses wideband codecs, maintains the buddy list, encrypts messages and determines if there is a firewall or not.

The login process: The login process is the most important one and it consists of several phases. As mentioned, SC must connect to a valid SN in order to authenticate the username and password with the Central Server.

Skype gets the fist IP from the host cache, sends it a UDP packet and waits for response. If there is no response after 5 seconds, it sends a TCP packet to the same IP. It tries to establish a TCP connection to the HC IP address and port 80 (HTTP port). If still unsuccessful, it tried to connect to IP address and port 443 (HTTPS port). If this does not work either, it reads the next address in the HC. If Skype is unable to connect to a SN, it will report a login failure.

The application comes with several build-in addresses of different nodes, called bootstrap super nodes.

If the connection attempt is successful, the client must authenticate the user name and password with the Skype login server, which holds all user names and passwords and makes sure they are unique across the whole network. When the application connects to an SN, it receives an up-to-date list of other active SNs, so it has the most current information.

The Media Transfer process: The video/voice communication through SKype is established through UDP. The trick here is that quite often, one of the users is behind a firewall or a router, hence it doesn't have a real IP address. But if both Skype clients are on real IPs, then the media traffic flows directly between them over UDP. The size of the voice packet is 67 bytes, which is actually the size of UDP payload. One second conversation results in roughly 140 voice packets being exchanged both ways, or 3-16 kilobytes/s.

If one of the callee or both of them do not have a public IP, then they send voice traffic to another online Skype node over UDP or TCP. The developers of Skype have preferred to use UDP for voice transmission as much as possible.

An interesting fact is that even if both sides are not speaking, voice packets will still be flowing between them. The purpose of these so called 'silent packages' is to keep the connection alive.

Conclusion: There are several factors responsible for the success of Skype. First of all, the voice quality is better compared to other applications. It works without a problem on computers with firewall. It is very easy to install and use. Skype's security is also a big advantage. Everything that is being transferred across the network is being encrypted to ensure privacy. As a result of that, even if hackers intercept the data being transferred, they won't be able to decode it.

The Skype application does not include any adware or spyware. But, there are cases when third parties have managed to add such functionalities (not only for Skype), so it’s really important that you download it from the right place.

No comments: