欢迎来到天天文库
浏览记录
ID:46538786
大小:109.00 KB
页数:13页
时间:2019-11-25
《基于tcp协议通信系统的设计与实现》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、基于TCP协议通信系统的设计与实现杨秀森(贵州师范大学机电学院电气工程及其自动化学号:091401010067)摘要:通信协议(communicationsprotocol)是指双方实体完成通信或服务所必须遵循的规则和约定。协议定义了数据单元使用的格式,信息单元应该包含的信息与含义,连接方式,信息发送和接收的时序,从而确保网络中数据顺利地传送到确定的地方。通信的底层通信是通过SOCKET套接字接口实现的。当前的主流UNIX系统和微软的WINDOWS系统都在内核提供了对SOCKET字接口的支持。使用这个
2、统一的接口,可以编写一个对移植的TCP通信程序。本文设计并实现了基于局域网内的简单即时通信系统,系统采用C/S模式,底层通信通过SOCKET套接字接口实现,服务器负责客八端的登录验证,好友信息的保存和心跳报文的发送。客户端采用P2P方式实现消息传递,并能实现文件的传输。本文首先讨论了同步套接字,异步套接字,多线程并发执行任务等;然后阐述了客户端、服务器如何使用XMI,序列化的消息进行通信。关键词:TCP协议;通信协议系统;套接7;文件传输;C/S模式;TheSystemDesignandImpleme
3、ntationofBasedonTCPProtocolCommunicationYangXiuSen(GuizhouNornialUniversityInstituteofmechanicalandelectricalengineeringanditsautomationnumber:091401010067)Abstract:Communicationprotocol(communicationsprotocol)referstobothentitiestocompletecommunication
4、orservicemustfollowtherulesandconventions・Theprotocoldefinesadataunitformat,informationunitshouldcontaininformationandmeaning,connectionmode,informationtransmissionandreceptiontiming,therebyensuringthatthenetworkdatasmoothlytransmittedtodetermineplaces.
5、CommunicationcommunicationisthroughtheSOCKETsocketinterfaceimplementation.ThecurrentmainstreamUNIXsystemandMicrosoftWINDOWSsysteminthekernelprovidestoSOCKETinterfacesupport・Usingtheunifiedinterface,canbepreparedinatransplantableTCPcommunicationprogram.T
6、hispaperdesignedandimplementedbasedonasimpleLANinstantcommunicationsystem,thesystemadoptsC/Smodel,theunderlyingcommunicationthroughtheSOCKETsocketinterfaceimplementation,serverfortheclienttologinauthentication,friendsofinformationpreservationandheartbea
7、tmessagesending・ClientusingP2Pmodetorealizetheinformationtransmission,andcanrealizethefiletransfer.Thispaperfirstdiscussesthesynchronizationsocket,asynchronoussocket,multithreadingconcurrentexecutionofthetask;andthendescribestheclient,theservercanusethe
8、XMLserializationofnewscommunication.Keywords:TCPprotocol;communicationprotocolsystem;socket;filetransfer;C/Smodel;1引言1.1研究背景在计算机通信中,通信协议用于实现计算机与网络连接Z间的标准,网络如果没有统一的通信协议,电脑Z间的信息传递就无法识别。通信协议是指通信各方事前约定的通信规则,可以简单地理解为各计算机Z间进行相互会话所使用的共同
此文档下载收益归作者所有