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

return len;

//存放格式化后的信息

char format_message[BUF_SIZE
;

//群聊

if(msg.type==0){

// 格式化发送的消息内容 #define SERVER_MESSAGE \"ClientID %d say >> %s\"

sprintf(format_message SERVER_MESSAGE clientfd msg.content);

memcpy(msg.contentformat_messageBUF_SIZE);

// 遍历客户端列表依次发送消息 , 需要判断不要给来源客户端发

list<int>::iterator it;

for(it = clients_list.begin(); it != clients_list.end(); ++it) {

if(*it != clientfd){

//把发送的结构体转换为字符串

推荐阅读