Windows to Mac database connection intermittently available after Windows Security prompt

I am trying to connect from a Windows 10 computer to a Firebird database server (port 3050) running on a Mac. This has been working fine until recently. I now only get intermittent access in a predictable way.

If I try to connect to the database on port 3050, I get an "Unable to connect to network host ..."

Unable to connect dialog

However, if I open a Windows Explorer window and try to navigate to the host as a UNC path (e.g. \\192.168.0.1), I get a Windows Security prompt.

Windows Security prompt

I don't have to enter anything in this at all, or submit the dialogue, but after this point, I can connect to the database server on the Mac for about 30 seconds or so.

Connection established dialog

Could anyone explain this behaviour with a view to getting more reliable access to the database again?

UPDATE

After gaining access to the iMac, I seem to be able to reproduce the issue by putting the iMac to 'sleep'. After putting to 'sleep', I can't access the database, then trying to navigate using Windows Explorer to the mac, I can call it. To me, it seems as though Windows Explorer is doing something to 'wake-up' the mac - temporarily at least - but a standard call to the database on port 3050 doesn't wake it up? Further investigating...


The issue appears to have been caused by the Mac going into Sleep mode.

It appears as though trying to connect using Windows Explorer from a Windows machine is issuing a Wake On Lan request, which wakes the target Mac for 30 seconds or so. During this 'wake' period I was then able to connect.

By implementing a Wake On Lan request from my application, I now seem to be able to reliably connect again to the target mac.

I would not have expected the target 'server' to be put into sleep mode, however, because we don't control the environment in which our software operates, we need to account for all possibilities really.

Because the target mac and windows computers are on different sub-nets, I've only been able to issue the wake on lan directly to the target mac's IP address, rather than completing a broadcast wake on lan.

I was able to modify the code available here to transmit the WOL to the target mac.