Use option parser for server
Tidied ip resolution