You can use the net module to check the peer connectivity details. There are two options:
1. To check if the current node is listening:
> net.listening
Returns true if it is listening and returns false if not.
2. To check if the number of peer connected:
> net.peerCount