Category Archives: Networks

Why are routers annoying ?

Why Cant i host a website on my PC ?

Why do we have to do port forwarding to use Bit-torrent fast enough?
What is port forwarding in the first place ?

the answer for these is because you have a router or they also call it a Layer 3- Switch

but before we can go on and explain why .. i must make sure that every one understands (or at least will understand someday) so i will have to make a fast intro to the networking world .. to reach that goal .. i will split this discussion into a couple of posts .. a series.. like the “My Programming Experience” series which was great because it was never continued 😉

so ..
lets pretend that we are going to build the networking stack from scratch .. and we will face problems and we will face them and solve them “by cheating from the current network stack” .. so i dont claim that what i will explain is very precise .. if u need that .. u can refer to a book or wikipedia after we are done.

  1. Network: an group of inter-connected machines .. that share resources to perform a task. “easy?”
  2. server: a machine in the network that provides a service .. mostly a resource or a piece of info. “okk ?”
    so note: ANY MACHINE can be a SERVER as long it has something to serve “Any one can cook!.. ok Remy ?”
  3. Client: i think its the machine that is served by the server. “its like fire has to burn because its fire!”
  4. Modem .. lets also call it Network Interface .. Adapter .. i will use these names to refer to the hardware and software logic that enables the Client and Server to interact

so lets say we are all connected by some magical wire to some Central .. and the connection between any two machines is like a phone Call .. one machine dials a number .. and starts talking .. so each machine has a number? .. what to call it? .. lets call it IP

ok .. so once you know the a machines IP .. you can communicate with it .. but wait .. lets notice that a machine, a computer is mainly applications, right ? .. so who needs to communicate ? .. these applications .. so likely you will say “i want to talk to MSN on Ali’s machine” in the phone case you use a name after you dial a number .. so lets use another identifier .. again a number .. now we call it PORT .. its where requests dock 🙂

and don’t ask me who choose that name “ports” .. because i have no idea!

now, when an application wants to communicate with another on another machine .. say two MSN messengers, each listens on port 55 on its own machine .. each talk through that port 55 to the other side and receives “listens” to info from that other side on that port too.

from the image, u see firefox tries to connect to some website’s Server, it uses port 1 to communicate, while the server sends its reply to your PC on port 1 again, since Firefox used it to send the request , then logically it is still waiting for the reply from the same address

Ports Explained .. click for a large image..


so what is these “addresses” ?
they refer to some application running on a machine
they consist of the IP and the port
by the way .. the most famous application that runs on a server is a “HTTP server” its an application that simply sends Web-Pages and processes them, by default it runs on port number 80

that’s it for today..
en shaa2 Allah: Routers, how they work

if you think i should have mentioned something and i didnt please add it in the comments. thanks..

Zemanta Pixie