Linux下區域網火車時刻表廣播系統設計與實現

才智咖 人氣:7.64K
畢業論文

目  錄

前  言 1
1 資料通訊的基本知識 2
1.1 TCP/IP 參考模型 2
1.2 IP 協議和UDP 協議 2
1.3 TCP協議 4
1.4 埠 5
1.5 本章小結 5
2 C/S模式概述 7
2.1 客戶/伺服器模型 7
2.2 套接字 9
2.2.1 套接字型別 9
2.2.2 套接字選項 10
2.2.3 套接字基本函式 12
2.3網路除錯法 15
2.3.1 ping命令 15
2.3.2 telnet命令 15
2.4 本章小結 16
3 火車時刻表廣播系統概要設計 17
3.1 需求分析 17
3.2 系統伺服器端的設計 18
3.2.1 火車時刻表獲取模組 18
3.2.2 火車時刻表廣播模組 22
3.3 系統客戶端的設計 24
3.3.1 火車時刻表接收模組 24
3.3.2 火車時刻表解析模組 24
3.4 本章小結 26
4 火車時刻表廣播系統的實現 27
4.1 標頭檔案quotes.h 27
4.2 建立套接字地址模組mkaddr.c 29
4.3 廣播資訊伺服器端 qserve.c 31
4.4 連線遠端伺服器模組connect.c 34
4.5 獲取資訊模組gettick.c 35
4.6 廣播資訊模組bcast.c 36
4.7 接收資訊客戶端mktwatch.c 38
4.8 解析資訊模組analysis.c 40
4.9本章小結 42
5 結束語 43
參考文獻 44
致謝辭 45
附錄  操作HTML程式碼 46
1 匯入檔案 46
2 程式設計提取資訊 46


 
Linux下區域網火車時刻表廣播系統設計與實現

 

摘要: Linux是1套免費使用和自由傳播的類Unix作業系統,它以高效性和靈活性著稱。使用者可以根據自己的需要對他進行必要的修改。
本論文利用Linux下通用的網路套接字,實現了1個基於Linux區域網的C/S模式(客戶機-伺服器模式)的廣播火車時刻表系統。
本論文內容分為兩個部分:基本知識和系統實現。基本知識介紹了基本的因特網協議和套接字程式設計;系統實現部分分為伺服器功能模組和客戶機功能模組。伺服器模組則重點闡述了怎樣利用流套接字從網上獲取免費火車時刻表資訊,以及利用資料報套接字進行火車時刻表資訊的廣播;客戶機模組實現了接收從伺服器廣播的資訊,並對該資訊進行解析,最後顯示出來。
關鍵詞:C/S模式;因特網協議;套接字;廣播
 
Design and Implementation of Train Schedule Broadcasting System Based on Linux in LAN

 

Abstract: The Linux is a kind of free UNIX operating system. It’s famous for its high efficiency and agile performance.
Users can modify it according to theirs need.
This thesis makes use of general network sockets of Linux to realize a Client -Server mode broadcasting system of the train schedule which based on Linux in LAN.
The content of the thesis is divided into two parts: the basic knowledge and The realization of the system。The basic knowledge introduces the basic Internet protocols and the sockets program; the system realization part has been divided into the server module and client module. The server module introduces how to get the free schedule of the train by stream socket, and makes use of the data socket broadcasts the information on the LAN ;The client module realizes how to receive the information from the server ,and then resolutes them, lists them at last.
Key words:  Client- Server mode, Internet Protocols, Sockets, Broadcast
前  言

Linux作業系統是UNIX作業系統在微機上的實現,它是由芬蘭赫爾辛基大學的Linus Torvalds於1991年開發並在網上免費發行的。
Linux以其獨特的特性迅速的蔓延至全球,它是可靠性非常高的系統,實踐已經表明,Linux系統可以不停機地穩定執行幾個月,甚至幾年。而且,因為Linux的出色的效能,已經成為中低檔次伺服器的首選,在伺服器市場上,它是Windows NT伺服器的最有力競爭者;在桌面系統上,它幾乎可以像Windows作業系統1樣方便的使用。而且它是1個全面的多工和真正的32位作業系統,它允許多個使用者同時在1個系統上執行多個程式;支援多種硬體平臺;使用虛擬記憶體和共享庫技術等[12]。
Linux系統的1個主要特點是它的網路功能非常強大,不僅僅因為Linux系統核心中緊密地集成了網路功能和有大量的網路應用程式,更因為Linux系統在超強網路需求下表現出的'令人驚奇的健壯性[3]。
隨著網路的日益普及,基於網路的應用也將日益增多。而本文利用通用的網路套接字,實現了1個基於Linux區域網內火車時刻表的廣播系統。該系統採用了網路應用中的客戶機-伺服器模式,伺服器採取迴圈模式不定時的應用TCP/IP流套接字,從因特網獲取最新的火車時刻資訊,並將其以廣播的形式釋出到本地區域網上;在區域網上的所有使用者只要執行客戶機程式,便可接收伺服器廣播而來的資訊。從而避免了所有的使用者都通過TCP/IP連線到同1伺服器上而造成的頻寬的浪費。

Linux下區域網火車時刻表廣播系統設計與實現