- 1、本文档共12页,可阅读全部内容。
- 2、有哪些信誉好的足球投注网站(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
基于tcp协议通信系统的的设计与实现
基于TCP协议通信系统的设计与实现
杨秀森
(贵州师范大学机电学院电气工程及其自动化 学号:091401010067)
摘要:通信协议(communications protocol)是指双方实体完成通信或服务所必须遵循的规则和约定。协议定义了数据单元使用的格式,信息单元应该包含的信息与含义,连接方式,信息发送和接收的时序,从而确保网络中数据顺利地传送到确定的地方。 通信的底层通信是通过SOCKET套接字接口实现的。当前的主流UNIX系统和微软的WINDOWS系统都在内核提供了对SOCKET字接口的支持。使用这个统一的接口,可以编写一个可移植的TCP通信程序。
本文设计并实现了基于局域网内的简单即时通信系统,系统采用C/S模式,底层通信通过SOCKET套接字接口实现,服务器负责客户端的登录验证,好友信息的保存和心跳报文的发送。客户端采用P2P方式实现消息传递,并能实现文件的传输。本文首先讨论了同步套接字,异步套接字,多线程并发执行任务等;然后阐述了客户端、服务器如何使用XML序列化的消息进行通信。
关键词:TCP协议;通信协议系统;套接字;文件传输;C/S模式;
The System Design and Implementation of
Based on TCP Protocol Communication
Yang Xiu Sen
(Guizhou Normal University Institute of mechanical and electrical engineering and its automation number: 091401010067)
Abstract: Communication protocol ( communications protocol ) refers to both entities to complete communication or service must follow the rules and conventions. The protocol defines a data unit format, information unit should contain information and meaning, connection mode, information transmission and reception timing, thereby ensuring that the network data smoothly transmitted to determine places. Communication communication is through the SOCKET socket interface implementation. The current mainstream UNIX system and Microsoft WINDOWS system in the kernel provides to SOCKET interface support. Using the unified interface, can be prepared in a transplantable TCP communication program.
This paper designed and implemented based on a simple LAN instant communication system, the system adopts C/S model, the underlying communication through the SOCKET socket interface implementation, server for the client to login authentication, friends of information preservation and heartbeat message sending. Client using P2P mode to realize the information transmission, and can realize the file transfer. This paper first discusses the synchronization socket, asynchronous socket, multithreading concurrent execution of the task; and then describes the client, the server can use the XML serial
文档评论(0)