What is the difference between an ethernet hub and switch?
An ethernet hub has two limitations. Firstly, it operates only in half-duplex, which restricts traffic flow, and has the effect of limiting the overall network traffic capacity to much less than the nominal data rate of any individual port. Secondly, a hub does nothing more than to distribute or 'broadcast' every received data frame at a port to every other port, irrespective of the address. In fact, the hub doesn't even look at the data frame's address. This too has the effect of diminishing the performance of the network, by loading ports with unnecessary traffic.
An ethernet switch however overcomes these obstacles firstly by allowing operation in full-duplex. More importantly however, a switch seeks to correctly distribute data frames to the correct destination port, which it does through use of the matching destination MAC addresses with entries it has built up in the 'learned address table' (LAT). The LAT is populated with data every time data is received at a port, with the switch noting for example, Host A is on port 1, Host B is on port 3 etc. When a message is received with Host A as the destination, the switch knows where to send the data. If it has no entry for Host A, in this case it must 'broadcast' it, i.e., send it to every port.
Most applications now benefit from switches in place of hubs. The lingering benefits of hubs are as a diagnostic tool to provide a retransmission of network data for network sniffing, and for specific deterministic networks like Ethernet Powerlink.