all 2 comments

[–]zanfarCCENT 1 point2 points  (1 child)

A socket is one-half of a TCP or UDP connection--the part specific to a single machine. It is defined by the source and destination IPs, source and destination ports and the transport protocol. It is common to speak of "opening a socket" to mean starting a TCP/UDP connection. A socket lets a single application (which must listen on a single IP and port to be reachable) communicate with multiple applications by using their unique IP/port combination.

A stack is generally the set of drivers and software dedicated to network communication on a host. For example, A TCP/IP stack might have a NIC driver which handles the Ethernet traffic, an IP driver, and a TCP driver. Each communicates with each other, and in a sense, other machines (and therefore other stacks) to allow network communication to operate. A driver generally refers to the software for a specific layer in a networking stack. A UDP driver would know the specifics of the UDP protocol, but nothing about IP--it would use the IP driver to handle that level of network communication.

There are loopback addresses and loopback interfaces. Loopback addresses are IP addresses from a specific range reserved for loopback purposes. A loopback address is usually assigned to a loopback interface and can be used to communicate with the local machine. The important part of a loopback address is that it still uses (to some extent) the networking stack to do so. In this way, it can be used to test some or all of the stack as the application layer doesn't necessarily know it's a test address.

A loopback interface usually refers to a virtual network interface (like a virtual NIC), but it doesn't necessarily get assigned a loopback address. This interface is useful because it cannot be disconnected, and is therefore usually used to identify a particular device on a network which might have several other addresses, but each of which might go down due to a cabling or other error. In a large network, the routers will each have several addresses asigned to interfaces used to connect different parts of that network. However, if the cable connected to an interface is disconnected, gets cut, or the device on the other end goes down, that address can no longer be used to communicate with the router. In this case, you can use the address assigned to the loopback interface--which is always up--to route through whatever links are still active to reach the device (and possibly fix the problem).

The phrase "communicate between software and a PC" is problematic because all network communication is between software or firmware to some extent. However, if you use a browser to connect to a web server on the same machine, the loopback address can be a useful to do so as you don't need to know the network address. Many software applications that need to communicate in this way will use the loopback address so they operate regardless of the physical network configuration--or even without a network interface at all.

The IP address and MAC address serve two very different purposes--they aren't really comparable at all. The MAC is used by the Ethernet Data Link layer to identify hosts within a single broadcast domain, while an IP address is used by the IP layer to identify hosts within the entire routable IP network. LAN and WAN have nothing to do with the differences between them--most LANs and WANs use both addresses.

A TCP/IP network is broken down into layers with each layer responsible for a specific task. When your computer makes a request to the Internet, the data is contained in a TCP Packet which has the destination's IP address, but that packet is contained in an Ethernet frame with your router's MAC address. The frame is forwarded to the router, where the packet is unpacked from the frame. The router then inspects the packet, and puts it into a new frame addressed to the next router in the path and sends it on its way. In this way, the packet eventually reaches the destination unchanged, but via a sequence of different Ethernet frames.

It's like filling a shipping container with corn and shipping it from Iowa, USA to St. Petersburg, Russia. The container and its contents stay the same through the whole trip, but it gets transported on a farm truck, semi trailer, cargo ship, and freight train at different times, each carrying the container for a portion of the total trip.

Using MAC-Only addressing is problematic because they (for the most part) aren't changeable, therefore routers would need to know every single MAC address in existence to send a packet the correct direction (over 281 trillion addresses). Using an IP scheme, hosts can be logically grouped into address blocks. Currently, an Internet routing table contains only about 650 thousand networks.

I would encourage you to get a CCNA-level or possibly a Network+ textbook if you want to explore these concepts further.

Note that this post is not only simplified but simplistic--it omits certain details in lieu of brevity. The information might technically be incorrect, but it is intended to provide an accurate conceptual understanding.

[–]RecursiveNoob[S] 1 point2 points  (0 children)

Thank you Very Very much!!! It really helped :)