Refactored create_socket

create_socket now attempts to connect and bind to every result of
getaddrinfo until it finds one that works before giving up
Removed server.h and fixed memory leak in error_response