A switch is a multiport device that handles routing between different hosts based on their MAC addresses. A switch ”learns” MAC addresses from the hosts that are connected to the switch, and stores them in an internal table. When two hosts communicate with each other, the switch creates a temporary connection path between them. This means that only two hosts will hear each other and not like the hub where everyone hears everything. For example if host A and host B have a conversation with each other, then host C and D can also communicate at the same time without any disturbance from host A or B. There is also possibility for one host to broadcast, which means that the packets will be transmitted on all ports in the switch.
Switches improve the performance of a LAN in two ways. First they increase the available bandwidth for each host, since the collisions are avoided.The second improvement is the security. A user on a host connected via a hub, can by using a sniffer software, hear other conversations. This is not possible in a switched network.