What piece of hardware and software recieves/encapsulates/sends the data pertaining to each layer of IP/TCP?
Ethernet hardware is typically only used at the lowest layers, the physical and link layers. Based on its MAC address, the hardware will only accept unicast frames that match. The Ethernet device driver is typically responsible for providing the software interface to this device. The device can typically read and write complete Ethernet frames from and to buffers arranged in a linked (circular) ring, and the driver either services interrupts or polls status for any change in buffer ring status (i.e. read or write frame operation complete).
The software is collectively known as the protocol stack. It is a collection of procedures and functions built into the kernel. They are invoked just like any hierarchy of software. When the user program makes a socket R/W system call, a top-layer application routine is invoked. This subroutine/procedure hierarchy is just like any other well-constructed software that enforces modularity, loose coupling and high cohesion.
Each layer in the protocol is performed by one or more (nested) procedure calls, until the data packet is stored in a frame buffer, ready for output by hardware. On successful write completion, the status is returned to the user's call.
For example, what layer does my router work on?
The Internet is described by the TCP/IP model :
- Application layer
- Transport layer
- Internet layer
- Link layer
- Physical layer
Your router directs packets based on IP address, which is the Internet layer.
But the router has its own protocol stack to perform other services like its web-based configuration utility. Every host on the network will probably have a complete protocol stack; the layers are not distributed among network hosts/devices.
What software translates a text file into SMTP?
Your mail program interfaces with the Application layer.
What/Where in my computer is the software for flow control/ transportation?
Probably the Transport layer, where TCP operates.