change socket, use snprintf