Thanks. It's what I kind of imagined.
In the mean time the nil pointer trick helped me find a part of the problem, I
think. Last will issues with nmqtt.
There is no simple way to do this: on program termination - graceful or not -
the operating system will clean up system resources that the program was using.
For example, this means that any TCP connections that were established will be
properly terminated by the operating system, informing the
Taskkill does not trip the server when it kills the client.
Dusting of the old labtop to test with that.
Thanks.
If you need it for testing purposes you can just use
[taskkill](https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/taskkill)
on the command line. I believe, `taskkill /f /pid ` should
forcefully end the process without any cleanup.
Another option is to simulate shu
That kills the client. Now the question is does Windows "clean things up"? The
server continues without problem.
When I run the client on a laptop over wifi and I switch of the wifi, the
server crashes. Same with an appliance that has a client, when I pull the plug
the plug, the server crashes.
For a slightly less nuclear option, try dereferencing a nil pointer to generate
a segfault
import os
var a:ptr[int]
sleep(1) # wait 10 seconds
echo a[]
Run
> BSOD
That's a bit too much, I'd like only the program to disappear, not the OS.
I tried it with an external program, but it is not enough:
#let s = fmt"winapiexec64.exe CreateRemoteThread ( OpenProcess 0x1F0FFF 0
{pid} ) 0 0 0xDEAD 0 0 0"
#let a = execCmd(s)
Calling undocumented function "NtRaiseHardError" from "ntdll.dll" will trigger
BSOD.
How does one create a program (on windows) that quits after some time in the
most ungraceful way. It is to simulate the disappearance of a client as if the
power was shut down.