以下是 client 端代码: void send(const std::string& message) { int sock = socket(AF_INET, SOCK_STREAM, 0); if (sock == -1) { std::cerr 0) { std::cout << buffer << std::endl; memset(buffer, 0, sizeof(buffer)); } close(new_socket); } close(server_fd); return 0; }