




版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領
文檔簡介
1、山東科技大學本科畢業設計外文文獻翻譯題目一 lan software running monitoring system件運行監控系統學院名稱專業班級 計算機09級1班學生姓名李燕偉學號0903204114指導教師連劍填表時間:2011年06刀8日the origins of c+: a little historycomputer technology has evolved at an amazing rate over the past few decades. today a notebook computer can compute faster and store more inf
2、ormation than the mainframe computers of the 1960s computer languages have evolved, too. the changes may not be as dramatic, but they are important. bigger, more powerful computers spawn bigger, more complex programs, which, in turn, raise new problems in program management and maintenance.in the 19
3、70s, languages such as c and pascal helped usher in an era of structured programming,a philosophy that brought some order and discipline to a field badly in need of these qualities. besides providing the tools for structured programming, c also produced compact,fast-running programs, along with the
4、ability to address hardware matters, such as managing communication ports and disk drives. these gifts helped make c the dominant programming language in the 1980s. meanwhile,the 1980s witnessed the growth of a new programming paradigm: object-oriented programming, or oop, as embodied in languages s
5、uch as smalltalk and c+. lets examine these c and oop a bit more closely.the mechanics of creating a programsuppose yoicve written a c+ program. how do you get it running? the exact steps depend on your computer environment and the particular c+ compiler you use, but they should resemble the followi
6、ng steps:1. use a text editor of some sort to write the program and save it in a file. this file constitutes the source code for your program.2. compile the source code this means running a program that translates the source code to the internal language, called machine language, used by the host co
7、mputer the file containing the translated program is the object code for your program.3. link the object code with additional code for example, c+ programs normally use libraries. a c+ library contains object code for a collection of computer routines, called functions, to perform tasks such as disp
8、laying information onscreen or calculating the square root of a number. linking combines your object code with object code for the functions you use and with some standard startup code to produce a runtime version of your program. the file containing this final product is called the executable code.
9、casyncsocketa casyncsocket object represents a windows socket an endpoint of network communication. class casyncsocket encapsulates the windows sockets api, providing anobject-oriented abstraction for programmers who want to use windows sockets in conjunction with mfc.this class is based on the assu
10、mption that you understand network communications. you are responsible for handling blocking, byte-order differences, and conversions between unicode and multibyte character set (mbcs) strings. if you want a more convenient interface that manages these issues for you, see class csocket.to use a casy
11、ncsocket object, call its constructor, then call the create function to create the underlying socket handle (type socket), except on accepted sockets. for a server socket call the listen member function, and for a client socket call the connect member function. the server socket should call the acce
12、pt function upon receiving a connection request. use the remaining casyncsocket functions to carry out communications between sockets upon completion, destroy the casyncsocket object if it was created on the heap; the destructor automatically calls the close function.csocketclass csocket derives fro
13、m casyncsocket and inherits its encapsulation of the windows sockets api. a csocket object represents a higher level of abstraction of the windows sockets api than that of a casyncsocket object. csocket works with classes csocketfile and carchive to manage the sending and receiving of data.a csocket
14、 object also provides blocking, which is essential to the synchronous operation of carchive blocking functions, such as receive, send, receivefrom, sendto, and accept (all inherited from casyncsocket), do not return a wsaewouldblock error in csocket. instead, these functions wait until the operation
15、 completes. additionally, the original call will terminate with the error wsaeintr if cancelblockingcall is called while one of these functions is blockingto use a csocket object, call the constructor, then call create to create the underlying socket handle (type socket). the default parameters of c
16、reate create a stream socket, but 訐 you are not using the socket with a carchive object, you can specify a parameter to create a datagram socket instead, or bind to a specific port to create a server socket. connect to a client socket using connect on the die nt side and accept on the server side. t
17、hen create a csocketfile object and associate it to the csocket object in the csocketfile constructor. next, create a carchive object for sending and one for receiving data (as needed), then associate them with the csocketfile object in the carchive constructor. when communications are complete, des
18、troy the carchive, csocketfile, and csocket objects.csocketfilea csocketfile object is a cfile object used for sending and receiving data across a network via windows sockets you can attach the csocketfile object to a csocket object for this purpose. you also can 一 and usually do 一 attach the csocke
19、tfile object to a carchive object to simplify sending and receiving data using mfc serialization.to serialize (send) data, you insert it into the archive, which calls csocketfile member functions to write data to the csocket object. to deserialize (receive) data, you extract from the archive this ca
20、uses the archive to call csocketfile member functions to read data from the csocket object.tip besides using csocketfile as described here, you can use it as a stand-alone file object just as you can with cfile, its base class. you can also use csocketfile with any archive-based mfc serialization fu
21、nctions. because csocketfile does not support all of cfile's functionality, some default mfc serialize functions are not compatible with csocketfile. this is particularly true of the ceditview class. you should not try to serialize ceditview data through a carchive object attached to a csocketfi
22、le object using ceditview: :serializeraw; use ceditview: serialize in stead the serializeraw function expects the file object to have functions, such as seek, that csocketfile does not have.using the mfc source filesthe microsoft foundation class libraiy (mfc) supplies full source code. header files
23、 (.h) are in the mfcmnclude directory; implementation files (.cpp) are in the mfcsrc directory.note the mfcsrc directory contains a makefile you can use with nmake to build mfc library versions, including a browse version a browse version of mfc is useful for tracing through the calling structure of
24、 mfc itself. the file readme.txt in that directory explains how to use this makefile.this family of articles explains the conventions that mfc uses to comment the various parts of each class, what these comments mean, and what you should expect to find in each section. classwizard and appwizard use
25、similar conventions for the classes they create for you, and you will probably find these conventions useful for your own codeyou might be familiar with the public, protected, and private c+ keywords when looking at the mfc header files, youll find that each class may have several of each of these.
26、for example, public member variables and functions might be under more than one public keyword. this is because mfc separates member variables and functions based on their use, not by the type of access allowed. mfc uses private sparingly 一 even items considered implementation details are generally
27、protected and many times are public. although access to the implementation details is discouraged, mfc leaves the decision to you.c+的起源:一個小的歷史過去的兒十年計算機技術以驚人的速度得到發展。今天,一個筆記本電腦 和20世紀60年代的電腦主機相比,計算的速度更快并且存儲更多的信息更 多。計算機語言也進化了。可能這些變化不富有戲劇性,但它們是重要的。更 大,更強大的計算機產生更大、更復雜的程序,這又反過來,提出在項目管理與維 護方面的新的問題在20世紀70年代,
28、像c和帕斯卡等語言幫助傳達員進入結構化程序設計 階段。一種哲學帶來了一個領域的一些新的指令和規則來滿足這些功能。隨著定 位硬件能力的增強,比如管理硬盤驅動等功能,c+除了提供結構化程序的工 具之外,也產牛了集成的快速運營的程序。這些功能得c成為20世紀80年代 占主導地位的編程語言。與此同時,c語言見證了 20世紀80年代的新編程范 式:而向對彖編程,或者是oop,體現在語言上例如smalltalk和c+。讓我們 驗證一下c和oop的聯系更密切。創建一個程序的技術假設你已經寫完了一個c+程序。你如何讓它運行?確切的步驟取決于你 的計算機應用環境和你使用的特定的c+編譯器,但他們應該遵循以下步驟
29、進 行:1o使用一個文本編輯器來編寫某一種類的程序并保存在一個文件中。這 個文件構成你的程序的源碼。2o編譯源代碼。這意味著運行一個把源代碼翻譯成內部語言也叫做機器 語言的程序,從而被主機應用。翻譯出來的程序文件包括的編譯文件也就是你 的程序的目標代碼3,把額外的代碼與目標代碼連接起來。例如,通常使用的c+程序庫。 一個c+庫,包括你的電腦日常運行所需要的目標代碼,被稱為函數,完成顯示 屏幕信息或計算一個數值的平方根的任務。把你的目標代碼與你使用的目標函 數的目標代碼和使用一些標準的啟動程序的代碼結合起來以產生你的程序的 運行版本。該文件包含這最后的結果就是所謂的可執行代碼。casyncsoc
30、ket一個casyncsocket對象代表了一個窗口,一個網絡通信的節點。 casyncsocket 類包含 windows sockets api,為想把 windows sockets 與 mfc 結合起來使用的程序員提供了一個面向對象的抽象的工具。這個類是建立在假定你理解網絡通信的基礎上。你是負責處理相互之間的 差異,字節順序的不同、轉換不統一的字符和處理多字節之間的差異并且設置 mbcs線。如果你想要一個比較方便的接口來管理你關注的問題,這就需要用 到 csocket 類。使用一個casyncsocket對象,調用它的構造函數,然后用構造函數的功能 構造需要的字節套接字,除了已經接受的
31、套接字。對于一個服務器套接字調用 監聽的子函數,并為接口套接字調用聯接函數。服務器套接字的功能是一接收 到聯接請求就接受請求。使用剩余casyncsocket函數能夠進行套接字之間的 交流。工程竣工后,如果是創建對彖的析構函數自動的廢堆,調用關閉函數。csocket類csocket源于casyncsocket和套接字窗口的api。一個csocket對象 代表了比casyncsocket object更高的更抽象的窗口套接字api。csocketfile csocket類和csocketfile類 以及carchive -起工作是為了管理發送和接收 的數據。一個csocket對象也提供阻斷,這是
32、與carchive同步運行的非常關鍵點。 阻斷的功能,比如接收、發送,接收自,發送到,接受(都是從casyncsocket繼 承來的),在csoket中不要返回一個wsaewouldblock誤差。而且,這些 函數將會等到所有的操作都結束。此外,如果取消阻塞調用被認為是阻塞函數 調用的一種,那么原來的調用將會與wsaeintr的謀差一起終止。為了使用一個csocket對象,又叫構造函數,然后調用是為了創建套接字 字節。按后默認的參數的創建一個套接字數據庫,但如果你沒有利用carchiv 對象,你可以指定一個參數創建一個數據包。或捆綁到一個特定的端口創建 一個套接字服務器端口。使用一個連接套筒連接到一個客戶端并且在在客戶端 和服務器端接受。然后創建一個csocketfile對象,然后把它和csocketfile 構造函數屮的csocket對象結合起來。其次,創建一個carchive對象來發送和 接收數據(如有必要),然后把這些和carchive構造的函數中的csocket對象結合 起
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯系上傳者。文件的所有權益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經權益所有人同意不得將文件中的內容挪作商業或盈利用途。
- 5. 人人文庫網僅提供信息存儲空間,僅對用戶上傳內容的表現方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
- 6. 下載文件中如有侵權或不適當內容,請與我們聯系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 護理藥品的管理
- 立體模型考試題及答案
- 青海煙草筆試題及答案
- 福安麥當勞面試題及答案
- 教育園區面試題及答案
- 休閑食品健康化轉型中的健康認證與市場拓展策略研究報告
- 工業互聯網平臺數據清洗算法在工業物聯網中的應用場景對比報告
- 重癥胰腺炎護理疑難病例討論
- 員工服務質量培訓
- 2025年食品行業食品安全追溯體系與食品安全監管信息化技術應用創新案例研究重點報告
- 2025年高考云南卷歷史高考真題(無答案)
- 中醫茶飲培訓課件模板
- 2025至2030中國實木門行業發展趨勢分析與未來投資戰略咨詢研究報告
- 2025年安徽省高考生物試卷(含答案解析)
- (湖北省高考卷)2024年湖北省普通高中學業水平選擇性考試高考物化生+政史地真題試卷及答案
- 真實情境下的“5E”教學模式在高中化學教學中的應用與成效探究
- 湖北省武漢市武昌區三年級下學期數學期末試卷(含答案)
- 2025年人教版七年級下冊地理全冊知識點
- 廣東省珠海市香洲區2023-2024學年七年級下學期語文期末試卷(含答案)
- 供熱領域自查工作報告
- 健康體檢教學課件
評論
0/150
提交評論