TASK: More solid method to send payload to the socket
TASK: More solid method to send payload to the socket

I can happens that fwrite does exit but without sending the full payload, or it can also happen that the pipe is closed or broken. With the change the logic a bit more complex but retry write operation. We need to silently ignore (@fwrite) notice/warnings from fwrite to be able to catch the broken pipe error (without the silent operator fwrite, will return a notice, and depending on the user php configuration, error handler, level, ... this can be converted to an exception or something that will skip the retry logic and our exception)
repejota/phpnats