文档库 最新最全的文档下载
当前位置:文档库 › 基于Linux的socket网络编程聊天工具课程设计

基于Linux的socket网络编程聊天工具课程设计

基于Linux的socket网络编程聊天工具课程设计
基于Linux的socket网络编程聊天工具课程设计

*****

《软件综合开发案例教程》课程设计报告

课程设计题目

小组成员:**,**,**,**

任课讲师和助教:**,**

2014年 10 月 29 日

摘要

这个课程设计整体采用在linux平台下,在同一局域网内实现聊天功能。整体框架主要分为服务端和客户端两个部分,设置好ip和端口号,在Linux下编译和调试两主大块程序,实现服务端和客户端的连接,然后以服务端作为中继转实现客户端之间的通信。使用socket网络编程采用TCP/IP协议保证连接可靠,并在项目管理中采用linux流行的gcc和makefile编译,提高了编译和调试效率,加快了项目的完成速度。

本次设计的聊天工具采用字符串命令行的方式进行通信,主要实现了五个功能:用户之间一对一的聊天、编辑、换行、用户之间聊天记录保存、聊天记录调取。经过测试,程序运行可靠,能满足在linux中实现网络聊天的要求。

关键词 linux,socket,gedit,服务端,客户端,网络编程

Abstract

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 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 https://www.wendangku.net/doc/ad17082356.html,e the socket network programming using TCP/IP protocol to ensure reliable connect, and using Linux popular GCC in project management and compile 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, chat 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

目录

摘要.......................................................................................................... II Abstract.................................................................................................... II 第一章绪论.......................................................................................... - 1 -

1.1、背景......................................................................................... - 1 -

1.2、网络聊天的发展状况 ............................................................ - 1 -

1.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 协议......................................................................... - 10 -

2.4.1、协议概述 ..................................................................... - 10 -

2.4.2、TCP/IP层次结构 ........................................................ - 10 - 第三章需求分析 ............................................................................... - 13 -

3.1 、功能需求 ............................................................................ - 13 -

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、模块测试 .............................................................................. - 15 -

4.3、测试结果分析 ...................................................................... - 16 - 第五章设计和实现 ........................................................................... - 16 -

5.1、窗体的设计 .......................................................................... - 16 -

5.2、实现服务器与客户端的连接 .............................................. - 17 -

5.3、聊天功能 .............................................................................. - 18 -

5.4、编辑功能的实现 .................................................................. - 19 -

5.5、换行功能的实现 .................................................................. - 20 -

5.6、数据库的创建与连接 .......................................................... - 21 -

5.6.1、MySQL数据库的简介 ............................................... - 21 -

5.6.2、MYSQL环境搭建 ...................................................... - 21 -

5.7 、显示聊天记录 .................................................................... - 23 -

结论................................................................................................ - 25 - 致谢................................................................................................ - 26 -

相关文档