The Design of Software (CLOSED)

A public forum for discussing the design of software, from the user interface to the code architecture. Now closed.

The "Design of Software" discussion group has been merged with the main Joel on Software discussion group.

The archives will remain online indefinitely.

direct connection

My knowledge of internet comm protocols is a bit lacking, so here goes my question:

If two PCs manage to connect to each other directly, bypassing firewalls and such (via a mechanism like Skype's), could they cache the information and do it again in the future without a middleman server? Is this how Skype does it or does each connection first have to go through the server and then revert to a more direct connection afterwards?
Thursday, August 07, 2008
This is extremely vague, but in general network connections do not require caching of any kind nor do they require a server to facilitate the connection.
BrotherBeal Send private email
Thursday, August 07, 2008
Trying to connect two computers (for file transfer, play LAN game, etc) even over a local network (no direct connection though, through a hub or something) can be tough, no? Different operating systems (even Win XP vs Vista), local firewalls, etc.. Too many settings...
Thursday, August 07, 2008
If the two endpoints (A and B) both have a firewall that prevents incoming connections, then they both establish a connection to a 3rd node C (which is called a "supernode"), which accepts both connections and which then relays the traffic between the A and B endpoints.

See and

> could they cache the information and do it again in the future without a middleman server

I don't think so: not while they both have firewalls which block any incoming connections.
Christopher Wells Send private email
Thursday, August 07, 2008
Typically, no. 

If the two machines are not directly connected by a single cable, then *something* has to move the bits around.  That *something* is typically a router, which may also provide firewall, proxy, etc. functionality.
BillAtHRST Send private email
Thursday, August 07, 2008
Actually it sounds pretty easy to me (modulo DHCP assigned floating IP addresses and other common nonsense):

The case the OP is asking about is where host A contacts a central host (C) to get addressing information for a third host (B). This is, I believe, the model used by Skype, which lists users and can direct you to a specific user on a host when that user is currently running the Skype software. Once host A has gotten the addressing information for host B from the central host C, C is out of the picture, and doesn't participate in the actual communication between A and B.

This is actually the model used by most TCP/IP communication: hosts get the addresses of other hosts via DNS lookups (the DNS servers play the part of central host C, and everybody else plays the parts of hosts A and B). Most DNS servers themselves are not "authoritative" hosts and have to go to even more central hosts to satisfy most addressing requests. This information is usually cached for some period of time (usually only a few hours), in order to minimize the load on the most central servers.

In this model it is pretty easy to reestablish a connection between A and B without the help of C, so long as the addressing information for A and B hasn't changed in the meantime. Even if ONE of the two hosts has changed their addressing information, the connection could still be reestablished by the host with the changed address contacting the host with the unchanged address (even if A's address changes, A can still contact B, so long as B's address has NOT changed).

So, to summarize, if you have previously established a direct connection between two TCP/IP hosts (A and B) and have saved the addressing information for each host on the other host (A saves a copy of B's address, B saves a copy of A's address) then you should be able to reestablish the direct connection without having to rely on any other hosts for help.
Jeffrey Dutky Send private email
Thursday, August 07, 2008
Jeffrey, that is all good in theory until one or the other machines is behind a firewall of some sort.
Thursday, August 07, 2008
> Is this how Skype does it or does each connection first have to go through the server and then revert to a more direct connection afterwards?

There are two issues:

1) Presence: where is the peer that I want to connect to? Is it running, somewhere on the internet, and registered with the Skype presence servers?

2) Media: know that I know that the peer exists, how can I establish a connection with it in order to exchange traffic with it?

Re. "presense", theoretically, peers can cache the results of a previous presence look-up (i.e. guess until proven otherwise that the desired partner is still wherever it was *previously* reported).

Re. "media", I don't know, but I'm guessing that Skype connections are peer-to-peer *if* the peers' firewalls etc. allow that ... otherwise, both peers connect to a third, unfirewalled supernode, and the run-time traffic is then relayed by the supernode.
Christopher Wells Send private email
Thursday, August 07, 2008
if you can arrange it, I believe it is often possible to get through firewalls, depending on the firewall and the degree of cooperation you can achieve.

As I understand it, when you attempt a connection to a remote IP, your own firewall caches that IP, and any incoming packets from that IP are thereafter recognised as being expected and allowed through for a certain period of time.

so effectively if you have two computers, each behind their own firewall, and they both attempt to connect to each other via IP over and over again, the likelihood is that they will eventually succeed.

Ive only been told this and have never actually attempted it, but I have often though it would be fun to play with.

does anyone have any additional knowledge on the subject?
Thursday, August 14, 2008
Christopher Wells Send private email
Thursday, August 14, 2008

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics
Powered by FogBugz