Add new function "ping" to global_functions, harden the socket listener