本科生毕业论文(设计)题目基于socket的局域网聊天程序的设计与实现学院软件学院专业软件工程学生姓名曾伟学号0643111112年级2006指导教师舒莉教务处制表二Ο一Ο年五月二十日四川大学本科毕业论文基于socket的局域网聊天系统的设计与实现1基于socket的局域网聊天程序的设计与实现软件工程学生曾伟指导老师舒莉[摘要]目前即时通讯软件在平时的生活中有着十分广泛的应用,但是对绝大部分的软件来说,都必须得应用在互联网上,必须在一个Internel环境下才能使用。有的时候单位内部的员工,同学,可能没有互联网环境或者其他的原因希望不用上Internet就可以进行通讯,这样开发局域网通讯程序就有了必要性。本文提出了局域网通讯软件的需求,并详细对网络协议TCP/IP协议族进行了介绍和研究,如TCP,UDP,广播,IP等相关的技术。并对网络通讯原理进行了说明,在此基础上利用Socket网络编程实现了一种基于windows平台的局域网聊天程序。程序采用了常用的P2P,C/S模型来实现,并整合了即时通信中的文本信息,文件传输,语音,广播,黑名单功能。该软件采用多线程技术支持多用户操作,能够帮助企业在局域网内搭建起自己的聊天系统。避免了必须的经过互联网的过程。经过测试,程序能够有效达到基本的预期要求。[关键词]局域网聊天程序;socket编程;TCP/IP;网络编程四川大学本科毕业论文基于socket的局域网聊天系统的设计与实现2TheTheTheTheDesignDesignDesignDesignandandandandImplementationImplementationImplementationImplementationofofofofaaaaLANLANLANLANChatChatChatChatApplicationApplicationApplicationApplicationBasedBasedBasedBasedononononSocketSocketSocketSocketSoftwareEngineeringStudent:ZengWeiAdviser:ShuLi[[[[AbstractAbstractAbstractAbstract]]]]Instantmessagingsoftwareinourdailyliveshasaverywiderangeofapplications,However,mostofthesoftwaresmustbeusedintheInternet,anditmustbeusedinaInternelenvironment.SometimesInternalstaff,students,maynothavetheInternetenvironmentorotherreasonsdonotwishtobeabletocommunicateontheInternet,ThisdevelopmentwillhaveaneedforLANcommunicationprogram.Therefore,thispaperpresentstheneedsoflocalareanetworkcommunicationsoftware,AnddetailsofthenetworkprotocolTCP/IPprotocolsuiteareintroducedandresearchsuchasTCP,UDP,broadcast,IPandotherrelatedtechnologies.andnetworkcommunicationtheoryisdiscussed.BasedonthisconditionIuseofSocketNetworkprogrammingbasedonwindowsplatformtodevelopaLANchatapplication.TheapplicationusesconventionalC/S,P2Pmodeltoachieve,andintegratedinthetextmessagereal-timecommunication,filetransfer,voice,broadcasting,blacklistfunctions.Thesoftwaresupportsmulti-threadingmulti-useroperation,CanhelpcompaniessetupintheLANfromtheirownchatsystem,AvoidtheneedoftheprocessthroughtheInternet.Aftertesting,theprogramcaneffectivelymeetthebasicexpectations.[[[[KeyKeyKeyKeyWordsWordsWordsWords]]]]LANchatapplication;socketprogramming;TCP/IP;networkprogramming四川大学本科毕业论文基于socket的局域网聊天系统的设计与实现1目目目目录录录录1绪论........................................................11.1论文背景及研究意义........................................11.2国内外研究现状............................................11.3论文的主要工作............................................21.4论文内容安排..............................................22基础技术研究................................................32.1TCP/IP协议研究...........................................32.1.1TCP/IP简介................................................................................................................32.1.2IP:网际协议.............................................................................................................42.1.3UDP:用户数据报协议...............................................................................................42.1.4广播.............................................................................................................................52.1.5TCP:传输控制协议...................................................................................................52.1.6TCP连接建立与终止..................................................................................................52.2局域网聊天系统............................................72.3SOCKET通信技术............................................72.3.1WindowsSocket规范................................................................................................72.3.2Socket网络编程原理................................................................................................82.3.3C/S模型介绍..............................................................................................................92.3.4P2P模型介绍............................................................................................................103系统需求分析与概要设计....................................113.1系统需求分析.............................................113.2系统整体框架.............................................113.2.1系统整体模块图.......................................................................................................113.2.2各模块简述...............................................................................................................123.3系统开发环境.............................................134系统详细设计与实现........................................144.1局域网聊天系统的设计.....................................144.1.1部署模块...................................................................................................................144.1.2Server模块..............................................................................................................174.1.3Client模块..............................................................................................................194.1.4文件传输模块...........................................................................................................214.1.5语音模块..............................................................................................