Posted by
Sven Van Caekenberghe-2 on
Sep 02, 2020; 7:36pm
URL: https://forum.world.st/ZnClient-how-suppress-popup-notifications-tp5121230p5121235.html
Hi Jimmie,
> On 2 Sep 2020, at 20:29, Jimmie Houchin <
[hidden email]> wrote:
>
>
> Before I get to my problem. I want to thank Sven for the huge effort that had to be made to provide all of the Zinc networking tools. Thank you.
Thanks, you're welcome.
> I am using ZnClient in an app. It is working fine. But I do not want any UI Notifications. This will eventually be headless on a server. But right now in development when the internet goes out I get a pop up from NameLookupFailure which offers me the options of "Give Up" or "Retry".
>
> I need to suppress this popup. I already have Error handling code which will catch NameLookupFailure among many other network based errors.
I know this is confusing, but this is not a problem. You can simply catch the NameLookupFailure and this will work as expected. The problem is the custom/overwritten NameLookupFailure>>#defaultAction which is doing UI stuff (although this gets handled differently in a headless image as well). IMHO this should be removed.
ZnClientTest>>#testIfFailNonExistingHost is an example that does more or less what you want.
> Also, is there a better way to check if the network is up other than simply making a request and either getting a successful response or an Error?
This is not such an easy problem to solve. Doing something simple, like accessing a known host, is one way (but never 100% since that host might be down on itself).
There is also the problem of timeouts (i.e. very slow networks).
One of my experimental projects,
https://github.com/svenvc/NeoDNS, does contains something called NeoNetworkState that tests internet connectivity by doing a DNS call. But this probably goes to far.
HTH,
Sven
> Thanks for any help.
>
>
> Jimmie