【正文】
學 士 學 位 論 文 基于 TCP/IP的局域網聊天室 的 設計與實現(xiàn) 姓 名: 學 號: 指導教師: 學 院 : 專 業(yè): 完成日期: 學 士 學 位 論 文 基于 TCP/IP的局域網聊天室 的 設計與實現(xiàn) 姓 名: 學 號: 指導教師: 學 院 : 專 業(yè): 完成日期: i 摘 要 隨著計算機網絡技術的發(fā)展,各種各樣基于網絡的應用也隨之 誕生 ,比如基于互聯(lián)網的信息發(fā)布,通信,數(shù)據(jù)共享等等。局域網的發(fā)展也同樣迅速。很多政府機構,企業(yè),學校,都是先以一個統(tǒng)一的局域網聯(lián)結在一起,再分別接入 ,就這樣應運而生了。所以本文提出了一個更加合理的設計,并在 WINDOWS 平臺上加以了實現(xiàn) .在本實現(xiàn)內將客戶端和服務端綜合在一個程序之內,用多線程實現(xiàn)不同的并行任務。并進行了人性化的界面設計,使用起來更加簡單方便,并且功能十分合理,又易于擴展以及個性化定制。本文通過 局域網 聊天系統(tǒng)來具體共享內存實現(xiàn)進程間的數(shù)據(jù)交換,利用 windows 消息機制實現(xiàn)進程間的同步,兩種機制結合使用。局域網聊天室作為一種新型的聊天工具可以提供更為及時、可靠、突破了必須有外界網絡接入等優(yōu)點, 具有極其廣泛的發(fā)展前景。 本文介紹了采用 JAVA 編程開發(fā)局域網聊天系統(tǒng)的一套比較常用的解決方案。采用 TCP 模式進行文字聊天 , 在客戶端之間點對點( C/C)的進行。本系統(tǒng)采用典型的 C/S(客戶端 /服務器 )的框架模式,在該方案中采用 Socket(套接字)原理實現(xiàn)網絡通信,最終實現(xiàn)了通過服務器中轉的文字聊天、文件傳輸功能,從而大大降低了程序的開發(fā)難度。本系統(tǒng)主要包括登 陸、聊天、好友列表和服務器管理幾個部分。本系統(tǒng)從需求分析、系統(tǒng)的設計、功能的實現(xiàn)都嚴格遵循了軟件工程設計的思想。 【關鍵詞】 Socket。TCP/IP。C/S。局域網聊天室 ii Abstract With the development of puter work technology, a variety of Webbased applications also will be the birth, such as Interbased information release, munications, data sharing, and so on. LAN development is quickly. Many government agencies, businesses, schools, are first linked together in a unified LAN, respectively connected to the INTERNET, LANbased instant messaging tool, and thus came into being. In this paper, a more rational design, in WINDOWS platform to achieve integrated in this realization of the client and server in different parallel tasks within a program, multithreaded. And the design of userfriendly interface, easy to use and very reasonable, and easy expansion and customization. LAN chat system to a specific shared memory data exchange between process and use the windows message mechanism to achieve interprocess synchronization, the two mechanisms used in conjunctionLAN chat room as a new chat tool that can provide the advantages of more timely, reliable, broke the need of outside work access, has a very wide range of development prospects. This article describes a JAVA Programming LAN chat system, a more mon solution. TCP mode, text chat, peertopeer (C / C) between the client. The system uses the framework of a typical C / S (Client / Server) mode, the program using the Socket (socket) the principle of work munication, and ultimately the transit through the server, text chat, file transfer capabilities, which greatly reduces the difficulty of program system includes landing, chat, friend lists, and server management of several parts. The system needs analysis, system design, the realization of functions strictly follow the idea of software engineering. 【 Key words】 Socket。TCP/IP。C/S; Local Area Network Chat Room I 目 錄 第 1 章 引言 ....................................................... 1 課題背景 ..................................................... 1 國內外研究現(xiàn)狀 ............................................... 2 主要內容 ..................................................... 3 第 2 章 局域網聊天室系統(tǒng)分析 ......................................... 4 系統(tǒng)需求分析 ................................................. 4 功能需求 ............................................... 4 系統(tǒng)基本流程圖 ......................................... 4 性能要求 ............................................... 5 測試環(huán)境規(guī)定 ........................................... 5 可行性研究 ................................................... 5 成本可行性分析 ......................................... 5 技術可行性分析 ......................................... 5 系統(tǒng)開發(fā)環(huán)境的分析 ........................................... 6 數(shù)據(jù)流圖 ..................................................... 6 頂層數(shù)據(jù)流圖 ........................................... 6 一 層數(shù)據(jù)流圖 ........................................... 6 第 3 章 系統(tǒng)設計 ..................................................... 7 設計目標 ..................................................... 7 構建開發(fā)環(huán)境 ................................................. 7 系統(tǒng)模塊流程圖 ............................................... 7 系統(tǒng)功能模塊圖 ............................................... 9 第 4 章 基于 Eclipse 的聊天室的分析與設計 ............................ 10 TCP 套接字的運用 ............................................ 10 TCP 三次握 手協(xié)議 ............................................ 11 程序結構 .................................................... 11 多用戶在線方案 ........................................ 11 II