資源簡介
本資源是基于linux下的一個簡易聊天室,有注冊、登陸、一對一私聊,一對多群聊功能。涉及到的知識點有l(wèi)inux基本知識,C語言,sqlite的基本操作,基本數(shù)據(jù)結(jié)構(gòu),Socket套接字

代碼片段和文件信息
#include?“myhead.h“
int?allchat(int?socketfdstruct?message?Msg)
{
int?sendcnt?=?0;
int?action?=?0;
int?toid?=?0;
char?sendbuff[20]={0};
char?name[20]?=?{0};
char?key[20]?=?{0};
char?id[20]?=?{0};
{
printf(“\n歡迎使用群發(fā)功能:\n“);
printf(“請輸入你要發(fā)送的消息“);
scanf(“%s“sendbuff);
//2.數(shù)據(jù)封包
action?=?4;
Msg.action?=?action;
strncpy(Msg.buffsendbuffstrlen(sendbuff));
//3.數(shù)據(jù)發(fā)送
sendcnt?=?write(socketfd&Msgsizeof(struct?message));
if(sendcnt?==?-1)
{
perror(“send“);
return(-1);
}
else
{
printf(“您要給服務(wù)器發(fā)送%d個字節(jié)的數(shù)據(jù):%s\n“sendcntMsg.buff);
}
}
// ????return?0;
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件??????17719??2017-08-22?03:56??chatroom\client\123
?????文件????????724??2017-08-20?17:40??chatroom\client\allchat.c
?????文件????????740??2017-08-20?17:40??chatroom\client\allchat.c~
?????文件???????2456??2017-08-20?17:44??chatroom\client\allchat.o
?????文件??????11340??2017-08-22?04:24??chatroom\client\client.c
?????文件??????11314??2017-08-20?17:40??chatroom\client\client.c~
?????文件??????14472??2017-08-20?17:44??chatroom\client\client.o
?????文件????????207??2017-08-22?03:55??chatroom\client\makefile
?????文件????????207??2017-08-19?00:23??chatroom\client\makefile~
?????文件???????1770??2017-08-18?14:33??chatroom\client\myhead.h
?????文件????????913??2017-08-20?17:41??chatroom\client\onechat.c
?????文件????????934??2017-08-18?19:38??chatroom\client\onechat.c~
?????文件???????2632??2017-08-20?17:44??chatroom\client\onechat.o
?????文件??????12288??2018-07-24?10:32??chatroom\server\.myhead.h.swp
?????文件??????18630??2018-07-24?14:21??chatroom\server\123
?????文件???????4741??2018-07-24?13:37??chatroom\server\flag.c
?????文件???????4986??2017-08-19?21:12??chatroom\server\flag.c~
?????文件???????5704??2018-07-24?13:37??chatroom\server\flag.o
?????文件???????1547??2018-07-24?14:18??chatroom\server\log.c
?????文件???????1739??2017-08-19?18:37??chatroom\server\log.c~
?????文件???????3624??2018-07-24?14:21??chatroom\server\log.o
?????文件????????245??2017-08-22?03:55??chatroom\server\makefile
?????文件????????245??2017-08-22?03:55??chatroom\server\makefile~
?????文件????????876??2018-07-24?13:34??chatroom\server\mod.c
?????文件???????1313??2017-08-19?10:36??chatroom\server\mod.c~
?????文件???????2832??2018-07-24?13:37??chatroom\server\mod.o
?????文件???????2120??2017-08-19?21:27??chatroom\server\myhead.h
?????文件???????2119??2018-07-24?14:21??chatroom\server\reg.c
?????文件???????3847??2017-08-20?17:42??chatroom\server\reg.c~
?????文件???????3072??2018-07-24?14:52??chatroom\server\reg.db
............此處省略10個文件信息
- 上一篇:(1510)循環(huán)碼的編解碼
- 下一篇:水果專家系統(tǒng)
評論
共有 條評論