I have a SQL Server Express 2017 instance running on a computer on my home network. I am developing/testing a different program on a different computer that connects to a DB on that SQL Server instance. Normally, this works fine, but occasionally it does not.

I asked about this several years ago, and somebody (I think it was Techgnome) gave me a very useful suggestion. If the computer with the DB has gone to sleep, occasionally it doesn't wake up right away. So, if there is a failure to connect at first, I wait 3 seconds and try again. Since this works most of the time, I haven't spent any great length of time examining the few times when it doesn't, but I just noticed something odd.

I ran the program, it connected to the DB without any issue...and then I found a bug, so I stopped the program and fixed that quickly. I was referencing an out of date version of a DLL, so it was just a matter of swapping in the correct DLL, which was a very quick fix. The computer hosting the DB certainly had no opportunity to go back to sleep in the seconds it took me to make that fix, but when I started it up again, the program failed to connect to the DB.

When connection fails, a few things get tried, which takes a couple seconds, then a window comes up that shows the various SQL Server installations, and I can test the connection against any of them. I chose the right one, and ran the test, and it connected without issue.

So, the program connected right away, the first time, but when I ran it a few seconds later, it failed...waited three seconds, then failed again, and after a bit of waiting...all was well.

I'm kind of at a loss as to what could be going on here. Being so intermittent, it's hard to do much diagnosing, since I can't count on the issue happening in any predictable fashion. So, what I'm looking for is any suggestion as to why a connection over a WiFi network can connect, then fail to connect the next time, which is maybe a minute after the successful connection?