coreserver: Add timeout to blocking I/O

Signed-off-by: Michael Buesch <m@bues.ch>
coreserver: Use getaddrinfo

Signed-off-by: Michael Buesch <m@bues.ch>