TCP

TCP provides connection oriented delivery. TCP requires that a session be established before hosts can exchange data. TCP is a means for building a reliable communication stream on top of the unreliable packet INTERNET PROTOCOL(IP).

TCP is the protocol that support nearly all internet applications.
the sending machine expects an acknowledgment for each packet. If a period elapses without an acknowledgment, it assumes that the information did not arrive and automatically resends it. Incase the packet delivered is damaged a negative acknowledgment NACK is sent. After this packet is resent again.

the other functions are allocating sequence number to each packet transmitted and handling flow control to make sure that the sender does not flood the receiver with packets.

HUBS

A HUB is a small rectangular box includes a series of ports that each accept a network cable. hub joins multiple computers together to form a single network segment. on this segment, all computers can communicate directly with each other.
HUBS are also known as multiport repeaters or concentrators. they connect various segments and acts like a repeater.this enables every segment to receive signals from any other segment.

Loop Avoidance

Redundant links are used to help stop complete network failures if one link fails. Even though redundant links are extremely helpful, they cause more problems than they solve. Because frames can be broadcast down all redundant links simultaneously, network loops can occur, among other problems.
If no loop avoidance schemes are put in place, the switches will flood broadcasts endlessly throughout the internetwork.

A device can receive multiple copies of the same frame since the frame can arrive from different segments at the same time.

One of the biggest problems is multiple loops generating throughout an internetwork. This means that loops can occur within other loops. If a broadcast storm were to then occur, the network would not be able to perform packet switching.

When a frame arrives at a switch interface, the destination hardware address
is compared to the forward/filter MAC database. If the destination hardware
address is known and listed in the database, the frame is only sent out the
correct exit interface. The switch does not transmit the frame out any interface
except for the destination interface. This preserves bandwidth on the
other network segments and is called
frame filtering
.
If the destination hardware address is not listed in the MAC database,
then the frame is broadcasted out all active interfaces except the interface the
frame was received on. If a device answers the broadcast, the MAC database
is updated with the device location (interface).

Forward/Filter Decisions

When a frame arrives at a switch interface, the destination hardware address
is compared to the forward/filter MAC database. If the destination hardware address is known and listed in the database, the frame is only sent out the correct exit interface. The switch does not transmit the frame out any interface except for the destination interface. This preserves bandwidth on the
other network segments and is called frame filtering.

If the destination hardware address is not listed in the MAC database,then the frame is broadcasted out all active interfaces except the interface theframe was received on. If a device answers the broadcast, the MAC databas is updated with the device location (interface).

Address Learning

When a switch is powered on, the MAC filtering table is empty. When a
device transmits and an interface receives a frame, the switch places the
source address in the MAC filtering table, remembering what interface the
device is located on. The switch has no choice but to flood the network with
this frame because it has no idea where the destination device is located.
If a device answers and sends a frame back, then the switch will take the
source address from that frame and place the MAC address in the database,
associating this address with the interface that received the frame.

switch now has two MAC addresses in the filtering table, the devices can
make a point-to-point connection, and the frames will only be forwarded
between the two devices. This is what makes layer-2 switches better than
hubs. In a hub network, all frames are forwarded out all ports every time.

Bridging versus LAN Switching

Layer-2 switches are really just bridges with more ports. However, there are
some important differences you should be aware of:

Bridges are software based, while switches are hardware based
because they use an ASICs chip to help make filtering decisions.

Bridges can only have one spanning-tree instance per bridge, while
switches can have many. (We cover spanning tree later in this chapter.)

Bridges can only have up to 16 ports, whereas a switch can have
hundreds.

There are three distinct functions of layer-2 switching:
Address learning
Layer-2 switches and bridges remember the source
hardware address of each frame received on an interface and enter this
information into a MAC database.
Forward/filter decisions
When a frame is received on an interface, the
switch looks at the destination hardware address and finds the exit interface
in the MAC database.
Loop avoidance
If multiple connections between switches are created
for redundancy, network loops can occur. The Spanning-Tree Protocol
(STP) is used to stop network loops and allow redundancy.