Network communication

Peter Korsten EMAIL HIDDEN
Tue Aug 16 00:42:38 CEST 2011


Op 16-8-2011 0:15, Mikael Hansson schreef:

> So let's put it like this: I want to understand how web communication works. I got some basic understanding of http but there's so many terms and concepts I only have a vague understanding of.
>
> Being new in the web/programming business I've found that there's a lot of supporting structures/things that it's good to have an understanding of and that it's quite easy finding information of "what" and "how" but more rarely "why", "where" and "when" :-)

Right. Well, at the bottom is TCP/IP. This is the protocol over which 
most of the internet (not WWW) travels. TCP stands for Transmission 
Control Protocol, IP stands for Internet Protocol. TCP/IP is has 
provisions for reliability, ordering and data integrity.

There's also UDP/IP (User Datagram Protocol), which lacks the provisions 
of TCP/IP, and it's often used for things like streaming media.

There are also some other protocols, but they're not that interesting 
for you. Even UDP isn't. Here's a starting point for IP:

http://en.wikipedia.org/wiki/Internet_Protocol_Suite

Now, IP is the internet layer, TCP and UDP are transport layers, and on 
top of those you have application layers like HTTP, FTP, SMTP, POP3, 
IMAP4, IRC, SSH, etc.

To access another computer on the internet, you need two things: an IP 
address (IPv4: four bytes, like 192.168.1.2; IPv6: 16 bytes) and a port 
number. Usually, but not necessarily, the application protocols can be 
reached on certain well-known ports. HTTP is associated with port 80; 
SMTP with port 25; SSH with port 22.

You could run an HTTP server on port 8080, but then the URL would be 
like this: http://localhost:8080/ . The ':8080' indicates the port number.

Now, there you've covered the protocols. HTTP is a way to send text and 
binary data to a client, based on a request with a URL (the http://... 
thing). The actual content could be HTML, XML, or a binary file like an 
image or a sound clip.

HTTP is a bit of a stupid protocol, in the sense that it's stateless. 
When you get a request from a client, there's no way to see if it's part 
of a session. So people (Netscape, actually) have invented cookies, in 
which session information can be stored. This information is sent with 
every request to the domain for which the cookie is set.

HTML is also a bit stupid, because it just displays formatted 
information; there's no interactivity. For this, they've invented AJAX, 
which is a piece of Javascript that sends XML to the server, so that 
instead of reloading the entire page, only the bits that need to be 
updated get updated. A good example of this is GMail, but you see it 
everywhere these days.

Anyway... my advice would be to click on the Wikipedia link above and 
take it from there. It's a vast subject, and you need to know what to 
skip. But that's something you'll have to figure out yourself.

- Peter



More information about the music-bar mailing list