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

bzero(send_buf BUF_SIZE);

memcpy(send_buf&msgsizeof(msg));

if( send(*itsend_buf sizeof(send_buf) 0) < 0 ) {

return -1;

//私聊

if(msg.type==1){

bool private_offline=true;

sprintf(format_message SERVER_PRIVATE_MESSAGE clientfd msg.content);

memcpy(msg.contentformat_messageBUF_SIZE);

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

list<int>::iterator it;

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

推荐阅读