Initialise server sockets and implement preliminary main loop