资源简介
在 Linux 环境下,利用 Socket 通信实现网络聊天程序,主要包括以下功能:
⑴ 写一个 shell 脚本,实现聊天界面的显示、用户的注册、登录(登录后可显示 用户昵称)、聊天方式的选择等功能。
⑵ 聊天方式分为:公聊和私聊。
⑶ 实现客户端之间网络传输文件。
⑷ 保存聊天记录,以备必要时查询。

代码片段和文件信息
/*************************************************************************
> File Name: char_room_cli.c
> Author: fujie
> Mail: fujie.me@qq.com
> Created Time: 2017年08月11日 星期五 08时58分20秒
************************************************************************/
#include
#include
#include
#include
#include
#include “Common/cJSON.h“
#include “./View/Main_UI.h“
#include “./Service/Connect.h“
extern int sock_fd;
int gl_uid;//记录登录用户的uid
int main(){
char buf[1024];
char host[50];
int fd = open(“config.json“ O_RDONLY);
if(fd == -1) {
printf(“配置文件打开失败!“);
getchar();
exit(0);
}
read(fd buf 1024);
cJSON* root = cJSON_Parse(buf);
cJSON* item = cJSON_GetobjectItem(root “host“);
strcpy(host item -> valuestring);
item = cJSON_GetobjectItem(root “port“);
int port = item -> valueint;
close(fd);
cJSON_Delete(root);
Connect(host port);
Main_UI_Hello();
close(sock_fd);
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2020-07-07 15:06 chat_room\
目录 0 2020-07-07 15:06 chat_room\Client\
目录 0 2020-07-07 15:06 chat_room\Client\Common\
文件 1959 2019-09-07 00:57 chat_room\Client\Common\Common.c
文件 938 2019-09-07 00:57 chat_room\Client\Common\Common.h
文件 2996 2019-09-07 00:57 chat_room\Client\Common\List.h
文件 27791 2019-09-07 00:57 chat_room\Client\Common\cJSON.c
文件 7526 2019-09-07 00:57 chat_room\Client\Common\cJSON.h
目录 0 2020-07-07 15:06 chat_room\Client\Common\libb64\
文件 166 2019-09-07 00:57 chat_room\Client\Common\libb64\AUTHORS
文件 1904 2019-09-07 00:57 chat_room\Client\Common\libb64\BENCHMARKS
文件 701 2019-09-07 00:57 chat_room\Client\Common\libb64\CHANGELOG
文件 1249 2019-09-07 00:57 chat_room\Client\Common\libb64\INSTALL
文件 1679 2019-09-07 00:57 chat_room\Client\Common\libb64\LICENSE
文件 405 2019-09-07 00:57 chat_room\Client\Common\libb64\Makefile
文件 4863 2019-09-07 00:57 chat_room\Client\Common\libb64\README
文件 0 2019-09-07 00:57 chat_room\Client\Common\libb64\TODO
目录 0 2020-07-07 15:06 chat_room\Client\Common\libb64\include\
目录 0 2020-07-07 15:06 chat_room\Client\Common\libb64\include\b64\
文件 648 2019-09-07 00:57 chat_room\Client\Common\libb64\include\b64\cdecode.h
文件 723 2019-09-07 00:57 chat_room\Client\Common\libb64\include\b64\cencode.h
目录 0 2020-07-07 15:06 chat_room\Client\Common\libb64\src\
文件 664 2019-09-07 00:57 chat_room\Client\Common\libb64\src\Makefile
文件 2502 2019-09-07 00:57 chat_room\Client\Common\libb64\src\cdecode.c
文件 2557 2019-09-07 00:57 chat_room\Client\Common\libb64\src\cencode.c
文件 461 2019-09-07 00:57 chat_room\Client\Makefile
目录 0 2020-07-07 15:06 chat_room\Client\RecvFile\
文件 5672 2019-09-07 00:57 chat_room\Client\RecvFile\chat_room_cli.o
文件 857404 2019-09-07 00:57 chat_room\Client\RecvFile\聊天室.pptx
目录 0 2020-07-07 15:06 chat_room\Client\Service\
文件 5002 2019-09-07 00:57 chat_room\Client\Service\Account_Srv.c
............此处省略65个文件信息
相关资源
- 酒店管理系统基于Qt Creator5)
- 用友NC开发API字典
- Navicat Premium 15汉化包.zip55438
- 登录注册界面.zip48872
- 条码字体barcode128
- Rational Rose Common破解文件
- res10_300x300_ssd_iter_140000.caffemodel与dep
- scratch 第1课 翻跟斗的小猫(入门)
- stm32f407上的两个can发送和接收例程
- Scrach 欢乐狙击手.sb2
- 04741计算机网络原理知识点整理.docx(
- Wolfram Mathematica 矩阵初等变换函数(
- pscad近海风电模型 Fortran语言
- 程序员专用字体YaHei.Consolas.1.11b42517
- scratch3.0 源程序(说相声)
- AutoCAD永久去教育版破解补丁
- 开源1A锂电池充电板TP4056原理图+PCB
- m1卡 ic卡可选择扇区初始化加密软件
- TSCC.exe
- 欧姆龙CP1系列单轴定位PLC程序.cxp
- 用Beckhoff(倍福)PLC读写巴鲁夫RFID
- CVSNT 完整覆盖版防TortoiseCVS中文乱码
- pfc 使用说明.doc
- Scratch 飞机大战.sb3
- STC8951系列单片机中方指南
- 《Visual Prolog 基础类》 中文参考.chm
- Omron ETN21模块进行modbustcp通讯
- 基于ACCESS的生产管理信息系统.mdb
- CANopen使用手册_埃斯顿
- Scratch 吃豆人追踪者.sb3
评论
共有 条评论