linux下C++ socket网络编程(20)

cout << \"ClientID = \" << clientfd

<< \" closed.\\n now there are \"

<< clients_list.size()

<< \" client in the char room\"

<< endl;

// 发送广播消息给所有客户端

else

{

// 判断是否聊天室还有其他客户端

if(clients_list.size() == 1){

// 发送提示消息

memcpy(&msg.contentCAUTIONsizeof(msg.content));

bzero(send_buf BUF_SIZE);

memcpy(send_buf&msgsizeof(msg));

send(clientfd send_buf sizeof(send_buf) 0);

推荐阅读