Okey with that..
But can you tell me why we use ports for connecting devices (generally in computers)
Let's try to clear it all up at the same time.
When talking about 'physical' items like microcontrollers, computers, cars, etc...
A 'PORT' is a collection of pins.
-This collection of pins is a logical group. ie, pins 14-19 belong to 'Port B'.
-Or can be a physical group. is, the collection of pins in a DB9 connector is the 'Serial' port.
Using Ports to deal with a set of pins is much easier than connecting to each pin by itself, or controlling each pin by itself. It's like handing someone paperwork for a job you need to do, but giving them all loose papers... Staple it together and call it a 'package' .. same kind of thing.
There is a confusing use for 'PORT' for computers though... and this refers to networking.
I will not go into extensive details, but every networked device has an address. On the internet, in order to communicate, computers need an 'ip address' and 'port' number to communicate over. In this situation, a port number can be compared to a 'channel' like in a radio. If you send the information on the wrong channel, it won't reach it's destination even if it's address is correct.