moved get second function to utils.c

Signed-off-by: jason-foo <fujianshuang@gmail.com>
fixed bug: converted udp port to network byte order twice

Signed-off-by: jason-foo <fujianshuang@gmail.com>
Added record lock to detect if user application is still running

I reused the pid file as a bit record lock. Two features are implemented on it:
1) there is at most one stupid server at the same time
2) when user applications either passively exit or are aborted accidentally, the
   server will detect it's not running any more, and collection the resource
   allocated to this application.

Signed-off-by: jason-foo <fujianshuang@gmail.com>