core/socket: common socket creation function for bind_to_*
core/socket: move socket buffer size setting to create_server_socket
core/socket: move listen queue size checking to create_server_socket
core/socket: move SO_REUSEADDR setting to create_server_socket
Merge pull request #499 from kunkku/socket-refactor

core/socket: eliminate some duplicated code from bind_to_* functions