【正文】
學(xué) 士 學(xué) 位 論 文 基于 TCP/IP的局域網(wǎng)聊天室 的 設(shè)計(jì)與實(shí)現(xiàn) 姓 名: 學(xué) 號(hào): 指導(dǎo)教師: 學(xué) 院 : 專(zhuān) 業(yè): 完成日期: 學(xué) 士 學(xué) 位 論 文 基于 TCP/IP的局域網(wǎng)聊天室 的 設(shè)計(jì)與實(shí)現(xiàn) 姓 名: 學(xué) 號(hào): 指導(dǎo)教師: 學(xué) 院 : 專(zhuān) 業(yè): 完成日期: i 摘 要 隨著計(jì)算機(jī)網(wǎng)絡(luò)技術(shù)的發(fā)展,各種各樣基于網(wǎng)絡(luò)的應(yīng)用也隨之 誕生 ,比如基于互聯(lián)網(wǎng)的信息發(fā)布,通信,數(shù)據(jù)共享等等。局域網(wǎng)的發(fā)展也同樣迅速。很多政府機(jī)構(gòu),企業(yè),學(xué)校,都是先以一個(gè)統(tǒng)一的局域網(wǎng)聯(lián)結(jié)在一起,再分別接入 ,就這樣應(yīng)運(yùn)而生了。所以本文提出了一個(gè)更加合理的設(shè)計(jì),并在 WINDOWS 平臺(tái)上加以了實(shí)現(xiàn) .在本實(shí)現(xiàn)內(nèi)將客戶(hù)端和服務(wù)端綜合在一個(gè)程序之內(nèi),用多線程實(shí)現(xiàn)不同的并行任務(wù)。并進(jìn)行了人性化的界面設(shè)計(jì),使用起來(lái)更加簡(jiǎn)單方便,并且功能十分合理,又易于擴(kuò)展以及個(gè)性化定制。本文通過(guò) 局域網(wǎng) 聊天系統(tǒng)來(lái)具體共享內(nèi)存實(shí)現(xiàn)進(jìn)程間的數(shù)據(jù)交換,利用 windows 消息機(jī)制實(shí)現(xiàn)進(jìn)程間的同步,兩種機(jī)制結(jié)合使用。局域網(wǎng)聊天室作為一種新型的聊天工具可以提供更為及時(shí)、可靠、突破了必須有外界網(wǎng)絡(luò)接入等優(yōu)點(diǎn), 具有極其廣泛的發(fā)展前景。 本文介紹了采用 JAVA 編程開(kāi)發(fā)局域網(wǎng)聊天系統(tǒng)的一套比較常用的解決方案。采用 TCP 模式進(jìn)行文字聊天 , 在客戶(hù)端之間點(diǎn)對(duì)點(diǎn)( C/C)的進(jìn)行。本系統(tǒng)采用典型的 C/S(客戶(hù)端 /服務(wù)器 )的框架模式,在該方案中采用 Socket(套接字)原理實(shí)現(xiàn)網(wǎng)絡(luò)通信,最終實(shí)現(xiàn)了通過(guò)服務(wù)器中轉(zhuǎn)的文字聊天、文件傳輸功能,從而大大降低了程序的開(kāi)發(fā)難度。本系統(tǒng)主要包括登 陸、聊天、好友列表和服務(wù)器管理幾個(gè)部分。本系統(tǒng)從需求分析、系統(tǒng)的設(shè)計(jì)、功能的實(shí)現(xiàn)都嚴(yán)格遵循了軟件工程設(shè)計(jì)的思想。 【關(guān)鍵詞】 Socket。TCP/IP。C/S。局域網(wǎng)聊天室 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 國(guó)內(nèi)外研究現(xiàn)狀 ............................................... 2 主要內(nèi)容 ..................................................... 3 第 2 章 局域網(wǎng)聊天室系統(tǒng)分析 ......................................... 4 系統(tǒng)需求分析 ................................................. 4 功能需求 ............................................... 4 系統(tǒng)基本流程圖 ......................................... 4 性能要求 ............................................... 5 測(cè)試環(huán)境規(guī)定 ........................................... 5 可行性研究 ................................................... 5 成本可行性分析 ......................................... 5 技術(shù)可行性分析 ......................................... 5 系統(tǒng)開(kāi)發(fā)環(huán)境的分析 ........................................... 6 數(shù)據(jù)流圖 ..................................................... 6 頂層數(shù)據(jù)流圖 ........................................... 6 一 層數(shù)據(jù)流圖 ........................................... 6 第 3 章 系統(tǒng)設(shè)計(jì) ..................................................... 7 設(shè)計(jì)目標(biāo) ..................................................... 7 構(gòu)建開(kāi)發(fā)環(huán)境 ................................................. 7 系統(tǒng)模塊流程圖 ............................................... 7 系統(tǒng)功能模塊圖 ............................................... 9 第 4 章 基于 Eclipse 的聊天室的分析與設(shè)計(jì) ............................ 10 TCP 套接字的運(yùn)用 ............................................ 10 TCP 三次握 手協(xié)議 ............................................ 11 程序結(jié)構(gòu) .................................................... 11 多用戶(hù)在線方案 ........................................ 11 II