Hub and Switch are the common term used in the Networking. Some network uses Hub, some Switch while some uses both. Basic purpose of both is same, to connect all devices tougher in networking. What is the difference between them?
If your network consists of very few nodes and you want to make networking in low cost then go for Hub is the best way. But keep in mind future expansions of the network.
Hub accept a single data packet from a sending device and broadcast it to all devices in the network and the actual node receives this packet. Only one data packet can pass through the hub at a time. When one node is broadcasting, it uses maximum bandwidth available, but when multiple nodes broadcasts bandwidth is share and it degrades the speed. In hub often generates collision of data
A switch have own capability to store MAC addresses of all the devices connected to its port. So when it receives data packet from a sending devices it recognize the device for which this data is from the MAC address and send that data only to that port to which the device is connect.
So unlike a hub, switch will allocate a full bandwidth to each of its ports. So regardless of the number of PCs transmitting, users will always have access to the maximum amount of bandwidth.
Router is completely different device rather than Hub and Switches. A Router is a getaway where two or more networks connected together. It may be a wired or wireless network or a network to Internet. Router uses routing table to find best path for forwarding the packet and send a packet using the Network ID. It also route to the destination host.