The run time error was because if the socket not bind then the array is not created, so in plugin_end makes error. I updated the source with the fix, I just moved the array creation.
And "failed to bind" because you don't have the port opened. Check the requeriments.