1、I 摘摘 要要 这个课程设计整体采用在 linux 平台下, 在同一局域网内实现聊 天功能。整体框架主要分为服务端和客户端两个部分,设置好 ip 和 端口号, 在 Linux 下编译和调试两主大块程序,实现服务端和客户端 的连接,然后以服务端作为中继转实现客户端之间的通信。使用 socket 网络编程采用 TCP/IP 协议保证连接可靠,并在项目管理中采 用 linux 流行的 gcc 和 makefile 编译,提高了编译和调试效率,加 快了项目的完成速度。 本次设计的聊天工具采用字符串命令行的方式进行通信,主要 实现了五个功能:用户之间一对一的聊天、编辑、换行、用户之间聊 天记录保存、聊天
2、记录调取。经过测试,程序运行可靠,能满足在 linux 中实现网络聊天的要求。 关键词 linux,socket,gedit,服务端,客户端,网络编程 II AbstractAbstract The course design of the overall use in the Linux platform, within the same LAN chat functions.Overall framework consists of server and client two parts, set up IP and port number, two main large program
3、under Linux compiling and debugging, to connect server and client, and then turn to the server as a relay to realize the communication between the client.Use the socket network programming using TCP/IP protocol to ensure reliable connect, and using Linux popular GCC in project management and compile
4、 a makefile, improve the efficiency of the compiling and debugging, to speed up the completion of the project. The design way of chat tool USES the string on the command line to communicate, has realized the five main functions: the one-on-one chat between users, editing, line feeds, chat records, c
5、hat records obtained between users.After testing, the program runs, reliable and can meet the requirements of the implementation in the Linux network chat. Keywords Linux, socket, gedit, server, client, network programming III 目录 摘 要 . I Abstract. II 第一章 绪论 . - 1 - 1.1、背景 - 1 - 1.2、网络聊天的发展状况 - 1 - 1
6、.3、 Linux 系统 - 2 - 1.3.1 、Linux 的简介 - 2 - 1.3.2 、Linux 发展历程. - 3 - 第二章 系统应用技术 - 4 - 2.1 、socket 概念及功能. - 4 - 2.2、 socket 类型 - 5 - 2.3 、socket 函数 - 5 - 2.3.1 、API 功能介绍 . - 5 - 2.3.2、套接口地址结构 . - 7 - 2.3.3、基本转换函数 . - 8 - 2.3.4、socket 编程流程 - 8 - 2.4、TCP/IP 协议 . - 9 - 2.4.1、协议概述 - 9 - 2.4.2、TCP/IP 层次结构 - 10 - 第三章 需求分析 - 13 - 3.1 、功能需求 . - 13 - IV 3.2、性能需求. - 13 - 3.3 、模块划分 . - 13 - 3.3.1、 界面需求设计 . - 14 - 3.3.2 、通信需求 - 14 - 3.3.3 、数据存储 - 14 - 3.4、系统总流程图 . - 14 - 第四章 系统测试 - 15 - 4.1、测试说明. - 15 - 4.2、模