receiving interface looks at the destination MAC number of the packet, and only buffers it if matches its own MAC number. While this method is easy to implement and quite effective on LANs,bigger networks (WANs, internet) don't use this method for obvious reasons; you wouldn't wanteveryone on the internet to send packets to everyone else on the internet. WANs use betterrouting mechanisms, which I won't discuss here. Just remember that at the lowest level, addressingis done with MAC numbers. Ethernet packets also include a CRC and error detection.
Just above the hardware level is the
level. IP simply stands for Internet Protocol. Just like theMAC layer, IP too has its own way of addressing:
The numbers used to address at the IP level of the network interface. IPv4,the version most widely used uses 32-bit values, noted in the well knowndotted format: 126.96.36.199. Unlike MAC numbers, IP numbers are nothardcoded into the hardware, they are assigned to it at software level.
IP numbers shouldn't be something strange to you. The internet uses them to uniquely identify aspecific computer. IP addresses can be assigned to a network interface using software. Doing thisassociates the IP number with the MAC address of the network interface. To address using IPnumbers, the associated MAC number needs to be resolved. This is done with the
(AddressResolution Protocol). Each host maintains a list with pairs of IP and MAC numbers. If an IP is usedwithout a matching MAC number, the host sends out a query packet to the rest of the LAN. If anyof the other computers in the LAN recognize their IP number, it sends back the corresponding MACnumber. If no matching MAC number can be found the packet is sent to the
, a computerthat forwards packages to external networks. The IP to MAC conversion is actually done at thedata link layer (MAC layer)The IP protocol adds the source and destination address (IP numbers) to the packet, as well assome other package properties such as the TTL hops (time to live hops), the protocol versionused, header checksum, sequence count and some more fields. They are not important to us so Iwon't explain them in detail.
The next layer is the TCP layer (or alternatively, the UDP layer). This layer is very close to thenetwork application and deals with many things. As final addition to the addressing, TCP adds aport number to the package:
While IP numbers are used to address a specific computer or network device,port numbers are used to identify which process running on that device shouldreceive the package. Port numbers are 16-bit, and thus limited to 65536numbers. A process can register to receive packets sent to a specific portnumber ('listening'). A notation often used when addressing a port number ona device is 'IP:portnumber', eg. 188.8.131.52:80. Both sides of a connectionuse a port number, but not necessarily the same.
Many port numbers are WKP (Well Known Ports), that is they are commonly associated with aspecific service. For example, the WWW uses port 80 by default, FTP uses port 21, e-mail uses 25(SMTP) and 110 (POP). Although these are the ports usually used for those services, nobody
Networking introduction - MadWizard.org
Winsock C++ programming tutorialPage 2 / 46Page 2 / 46