Gets the number of ports belonging to the block.
This method is thread-safe while the pipe is running.