Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does Skype work without port forwarding?

I am designing a p2p application which works on port 30000. My router is not UPnP so I required to forward a port to router. But Skype a another p2p application works without port forwarding on my pc. When I analyzed it with wireshark I found its using UDP port 48980, 58544. I am using c++.

There is a library in python here which does it for Nat PnP routers. Is it possible to programmatically forward port to router irrespective of type of router and operating system. What should be the approach to do it in c++ or any other language.

like image 737
Xinus Avatar asked Oct 08 '09 17:10

Xinus


People also ask

Is port forwarding necessary?

Port forwarding is needed when a machine on the Internet needs to initiate a connection to a machine that's behind a firewall or NAT router.

What can I do instead of port forwarding?

There are eight alternatives to Simple Port Forwarding for Windows, Linux and Mac. The best alternative is UPnP Wizard, which is free. Other great apps like Simple Port Forwarding are Multi Port Forwarder, AUTAPF, PFConfig and Port Map. Simple Port Forwarding works with WebPages and not directly with your router.

What ports does Skype use?

For Skype to work correctly, the following ports need to be open in your firewall: 443/TCP. 3478-3481/UDP. 50000-60000/UDP.


1 Answers

Skype works in a very interesting way. From what I've read (and this is a while ago) it works as follows:

  • Skype server maintains a list of all users and IPs.
  • Skype user A wants to speak to user B
  • Skype user A sends a network packet to user B's IP address and waits for a response. (user B never gets this packet).
  • Skype user A notifies server of IP/port combination on which it is waiting for a response
  • Server notifies user B to send a response to user A on the specified port
  • A connection is made.

This is probably over simplified but last I checked, this is how it works. (Someone correct me if I'm wrong).

Edit: fixed bullet issue

like image 79
rein Avatar answered Sep 29 '22 06:09

rein