Connecting to the server on the second attempt

When I turn on my computer and connect to my server, I get a message that I can’t connect. But if I click “connect” again, I can connect to the server. What could be the cause of this problem?
When I disconnect after a successful connection and try to connect again, I can connect the first time.

<16:01:47> Trying to connect to server at 185.17.0.11
<16:01:52> Failed to connect to server
<16:01:53> Trying to connect to server at 185.17.0.11