JISHOUUNIVERSITY专业课课程论文题目:基于TCP协议的即时通信软件的设计与实现作者:学号:所属学院:信息科学与工程学院专业年级:总评分:完成时间:吉首大学信息科学与工程学院基于TCP协议的即时通信软件的设计与实现(吉首大学信息科学与工程学院,湖南吉首416000)摘要即时通信,由于其具有实时性、跨平台性、成本低、效率高等优点而受到广泛的使用。设计并实现一个能够处理多用户进行实时、安全的即时通信系统具有较强的现实意义。即时通信的底层通信是通过SOCKET套接字接口实现的。当前的主流UNIX系统和微软的WINDOWS系统都在内核提供了对SOCKET字接口的支持。使用这个统一的接口,可以编写一个可移植的TCP/IP通信程序。使信息能够在INTERNET上可靠的传输。本文设计并实现了基于局域网内的简单即时通信系统,系统采用C/S模式,底层通信通过SOCKET套接字接口实现,服务器负责客户端的登录验证,好友信息的保存和心跳报文的发送。客户端采用P2P方式实现消息传递,并能实现文件的传输。本文首先讨论了同步套接字,异步套接字,多线程并发执行任务等;然后阐述了客户端、服务器如何使用XML序列化的消息进行通信。关键词:即时通信;文件传输;套接字;TCP协议TheDesignandImplementationofSimpleInstantMessageSoftwareBasedonTCPProtocolAbstractYiZhenkai(CollegeofInformationScienceandEngineering,JishouUniversity,Jishou,Hunan416000)AbstractInstantmessageshaveseveraladvantagessuchasreal-time,cross-platform,cheapandefficient.TodesignaMulti-userIM(instantmessage)architectureisveryimportantinboththeoryandrealism.InstantmessagebasedonTCP/IPprotocolthatisrealizedbysocketinterface.AlmostallUNIXoperationsystemsandMicrosoft'swindowsoperationsystemsprovidesupportofsocketinthekernel.Usingtheuniforminterface,wecandevelopaportableprogramofTCP/IP,whichhelpustransferinformationinInternetsafelyandcredibly.Thesystemusestheclient/server(C/S)mode.Theservertakestheresponsibilityoftheloginmessageofclient,thesavingoffriendmessageandMessageheartbeat.ThetransmissionofthebasicmessagesofthecustomerendwillbedesignedonP2Parchitecture.ThisthesisexplainshowtheclientandservercommunicateviaserializingXMLmessage.Keywords:InstantMessage;FileTransfer;Socket;TCPprotocol目录第一章引言.........................................................................................................................11.1课题背景...........................................................................................................................11.2国内外研究现状...............................................................................................................11.2.1国外研究现状..............................................................................................................11.2.2国内研究现状.............................................................................................................21.3课题研究的意义................................................................................................................21.4课题的研究方法...............................................................................................................2第二章相关技术介绍.............................................................................................................32.1TCP协议...........................................................................................................................32.1.1TCP/IP网络协议.........................................................................................................32.1.2TCP——传输控制协议................................................................................................32.2套接字................................................................................................................................32.3流........................................................................................................................................42.3.1流的基本概念.............................................................................................................42.3.2.NET中的流.................................................................................................................42.4同步、异步、阻塞和非阻塞............................................................................................42.5C/S模型.............................................................................................................................52.6即时通信协议....................................................................................................................5第三章系统总体设计.............................................................................................................73.1需求分析............................................................................................................................73.2系统基本架构....................................................................................................................73.3功能模块设计....................................................................................................................73.4逻辑图................................................................................................................................93.5数据库设计........................................................................................................................93.5.1实体关系图..................................................................................................................9第四章系统实现...................................................................................................................114.1使用XML定义的即时通信协议....................................................................................114.1.1信息结构MESSAGE.CS&UMESSAGE.CS....................................................................114.1.2数据结构Fr