Use nc -zv <IP> <port> to connect with an port.
nc -zv <IP> <port>
By using an hypen, one can provide a range of ports: 22-25