Connect Mongo to set

I am using mongo.exe to get diagnostics of the set status. Every few seconds I receive and parse db.Status.
connection string:

It works well.

But if all copies are lost, I watch it endlessly

This can take tens of minutes.
how do i restrict connection attempts? For example, if 3 losses do not need to continue to beat against the wall