freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

畢業(yè)設(shè)計(jì)-簡易代理服務(wù)器的設(shè)計(jì)—論文-wenkub

2022-12-12 17:42:06 本頁面
 

【正文】 送出Request 信號來得到回答,然后對方再把信息以 bit 方式傳送回來。主要的功能有: 連接 Inter 與 Intra 充當(dāng)防火墻:因?yàn)樗袃?nèi)部網(wǎng)的用戶通過代理服務(wù)器訪問外界時(shí),只映射為一個(gè) IP地址,所以外界不 能直接訪問到內(nèi)部網(wǎng);同時(shí)可以設(shè)置 IP地址過濾,限制內(nèi)部網(wǎng)對外部的訪問權(quán)限;另外,兩個(gè)沒有互聯(lián)的內(nèi)部網(wǎng),也可以通過第三方的代理服務(wù)器進(jìn)行互聯(lián)來交換信息。 提高訪問速度:本身帶寬較小,通過帶寬較大的 proxy 與目標(biāo)主機(jī)連接。例如,大家在一些論壇上看到,論壇中明確標(biāo)出了發(fā)帖用戶目前所在地,這就是根據(jù)論壇會員登錄時(shí)的 IP 地址解析的。 代理服務(wù)器有許多種,大體來說有 HTTP,FTP,SOCKS 代理 三種,其中又分透明代理和不透明代理。機(jī)器 和代理服務(wù)器通訊時(shí),目的 IP 是代理服務(wù)器的 IP。只有從數(shù)據(jù)中才能看到。有了網(wǎng)絡(luò)地址轉(zhuǎn)換器,家庭網(wǎng)絡(luò)或小型的辦公網(wǎng)絡(luò)中的電腦就可以使用私有地址,并且通過網(wǎng)絡(luò)地址轉(zhuǎn)換器將私有地址轉(zhuǎn)換成 ISP 分配的單一的公用 IP 地址從而實(shí)現(xiàn)對 Inter 的連接。 NAT 方式也稱之為 Inter 的路由連接。 例如有 軟件: WinRoute,Sygate。這時(shí),服務(wù)器程序被“喚醒”,并開始響應(yīng)客戶機(jī)提出的連接請求。 客戶端創(chuàng)建套接字后即可調(diào)用 connect 函數(shù)去試圖連接服務(wù)器監(jiān)聽套接字。 Winsock庫 Winsock 是 Windows 下網(wǎng)絡(luò)編程的標(biāo)準(zhǔn)接口,它允許兩個(gè)或多個(gè)應(yīng)用程序在相同機(jī)器上,或者是通過網(wǎng)絡(luò)相互交流。 winsock 的尋址方式 因?yàn)?Winsock 要兼容多個(gè)協(xié)議,所以必須使用通用的尋址方式。定義如下: Struct sockaddr_in{ short sin_family。 }。 第 6 頁 共 20頁 字節(jié)順序 字節(jié)順序是長度跨越多個(gè)字節(jié)的數(shù)據(jù)被存儲的順序,分為小尾順序和大尾順序, TCP/IP 統(tǒng)一規(guī)定使用大尾順序方式傳輸數(shù)據(jù),即網(wǎng)絡(luò)字節(jié)順序 ,它的字節(jié)順序是最重要的字節(jié)首先存儲 。 系統(tǒng)基本套接字調(diào)用 創(chuàng)建和關(guān)閉套接字- socket()和 closesocket() 應(yīng)用程序在使用套接字前,首先必須擁有一個(gè)套接字,系統(tǒng)調(diào)用 socket()向應(yīng)用程序提供創(chuàng)建套接字的手段 ,如果成功將返回套接字句柄,如果創(chuàng)建失敗,返回 INVALID_SOCKET(即 1)。它用在沒有建立連接的套接字上, 如果沒有錯(cuò)誤發(fā)生, bind()返回 0。注意:地址在建立套接字通 信過程中起著重要作用, 程序使用中通??刻畛鋝ockaddr_in 結(jié)構(gòu)來綁定套接字到本地地址。 Listen 函數(shù) 僅應(yīng)用在支持連接的套接字上,如 SOCK_STREAM 類型。之后,服務(wù)端就會調(diào)用 accept(),而在 調(diào) 用 accept ()的參數(shù)前應(yīng)該先調(diào)用過 listen(),Accept 函數(shù)定義如下: SOCKET accept(SOCKET soc, struct sockaddr * addr, int * addrlen)。 Flags 參數(shù)在這兩函數(shù)中通常設(shè)為 0。在處理數(shù)據(jù)請求的過程中,我們必須知道 Server 的地址,這是非常重要的。如果用戶輸入一個(gè)數(shù),而且指定使用這一端口號,則應(yīng)用程序必須在使用它建立地址以前,把它從主機(jī)順序轉(zhuǎn)換網(wǎng)絡(luò)順序(使用 htons()函數(shù))。實(shí)際上,這里主要有兩個(gè)問題要考慮:第一,從 Socket 按行讀取數(shù)據(jù)最適合進(jìn)一步處理,但這會產(chǎn)生性能瓶頸;第二,兩個(gè) Socket 之間的連接必需高效。因此,對于每一個(gè)請求,我們將用一個(gè)線程處理數(shù)據(jù)的接收和發(fā)送,同時(shí)在數(shù)據(jù)到達(dá)代理服務(wù)器時(shí),盡可能快速地把它轉(zhuǎn)發(fā)出去 。 圖 4 Library files設(shè)置 功 能實(shí)現(xiàn) 數(shù)據(jù)變量定義 定義代表 協(xié)議 的 變量 HTTP, 定義緩 沖區(qū)大小變量MAXBUFFERSIZE。 if(::WSAStartup(0x202,amp。 } 之后,創(chuàng)建一個(gè)代理服務(wù)器( Proxy)用于網(wǎng)絡(luò)通信的套接字 listen_socket。 =AF_INET。 =htons(port)。local,sizeof(local))!=0) { printf(\n Error in Binding socket.)。 請求處理過程 在這一步設(shè)計(jì)函數(shù) ClientToProxy 來處理收到客戶請求,并將請求合理傳送至 Server(客戶請求的數(shù)據(jù)服務(wù)器 )。fromlen)。 如果此客戶端到代理服務(wù)器的連接正確,我們就在這一 socket 連接上使用revc 函數(shù)接收數(shù)據(jù)。 retval=recv(,Buffer,sizeof(Buffer),0)。 =TRUE。 第 12 頁 共 20頁 下面的一步,需要把這些數(shù)據(jù)信息傳給 Server。proto 保存協(xié)議。 至此,啟動一個(gè)新的子線程,用于處理代理服務(wù)器和數(shù)據(jù)服務(wù)器間的數(shù)據(jù)傳輸。 printf(\n send() failed:error%d\n,WSAGetLastError())。直到接下來的處理不出錯(cuò)為止。 Len=retval。首先要做數(shù)據(jù)服務(wù)器 Server主機(jī)地址信息的轉(zhuǎn)換,定義一 個(gè) hostent 結(jié)構(gòu)變量 *hp來保存。 server_name = pParAddress。如果 server 的地址是字母類型的,就使用 gethostbyname( server_name)函數(shù) 返回對應(yīng)于給定主機(jī)名的主機(jī)信息 (把 IP地址串當(dāng)作一個(gè)未知主機(jī)名同樣處理 );否則,應(yīng)用 i_addr( server_name) 把地址串轉(zhuǎn)換為 IP 地址 ,再用 gethostbyaddr 得到 hostent結(jié)構(gòu) 賦值給 hp 指針。 } 有了解析后的地址信息后,下一步,將這些信息拷貝給 sockaddr_in 結(jié)構(gòu)。(),hph_addr,hph_length)。 conn_socket = socket(AF_INET,socket_type,0); 打開一個(gè) socket,如果打開失敗,顯示錯(cuò)誤信息,關(guān)閉代理服務(wù)器到服務(wù)器的連接狀態(tài), if (conn_socket 0 ) 第 14 頁 共 20頁 { fprintf(stderr,Client:Error Opening socket: Error %d\n,WSAGetLastError())。 retval = recv(conn_socket,Buffer,sizeof (Buffer),0 )。 break。 pParpPairStateProtoSerClosed=TRUE。 fprintf(stderr,send() failed: error %d\n,WSAGetLastError())。 ifdef _DEBUG Buffer[Len]=0。首先用 closesocket(listen_socket)關(guān)閉套接字 句柄 ,再用 WSACleanup()來釋放分配給指定應(yīng)用程序的資源 。實(shí)現(xiàn)如下: cout請?jiān)O(shè)置代理服務(wù)器端口號 ...endlPort:。 if(getchar()==39。 5 測試結(jié)果 完成程序的代碼編寫,通過調(diào)試,修改出現(xiàn)的問題后,將 設(shè)計(jì) 的程序通過“ Build”菜單,選擇 “ Rebuild All” 菜 單項(xiàng)重新編譯程序,再通過“ Ctrl+F5” 命令生成 .EXE 的執(zhí)行程序。這時(shí)客戶端的瀏覽器的請求轉(zhuǎn)向我們的代理服務(wù)程序,代理程序轉(zhuǎn)發(fā)請求給 baidu 服務(wù)器,并從它那兒取回?cái)?shù)據(jù),顯示在瀏覽器上,結(jié)果如下: 圖 7 通過代理的數(shù)據(jù)請求結(jié)果 可見,我們設(shè)計(jì)的簡易代理服務(wù)程序成功完成了目標(biāo)。它不具備良好的用戶界面,由于緩存的設(shè)置可能導(dǎo)致程序溢出。 [3] 汪曉平 ,劉韜 .Visual C++ 開發(fā)網(wǎng)絡(luò)典型應(yīng)用實(shí)例導(dǎo)航 [M].北京:人民郵電出版社 ,2021。 [7] 孔鵬 .完全自學(xué)手冊 Visual C++ [M].北京:機(jī)械工業(yè)出版社 ,2021。除非另有說明,本文的工作是原始性工作。 ( 4)學(xué)??稍试S學(xué)位論文被查閱或借閱。t they? Hannah washed and ironed them for me, and I marked them all myself, said Beth, looking proudly at the somewhat uneven letters which had cost her such labor. Bless the child! She39。t that right? I thought it was better to do it so, because Meg39。s all right, dear, and a very pretty idea, quite sensible too, for no one can ever mistake now. It will please her very m uch, I know, said Meg, with a frown for Jo and a smile for Beth. There39。m truly trying not to be selfish any more. As she spoke, Amy showed the handsome flask w hich replaced the cheap one, and looked so earnest and humble in her little effort to fet herself that Meg hugged her on the spot, and Jo pronounced her `a trump39。m so glad you came before we began! May I go and help carry the things to the poor little children? asked Beth eagerly. I shall take the cream and the muffings, added Amy, heroically giving up the article she most liked. Meg was already covering the buckwheats, and piling the bread into one big plate. I thought you39。s loving our neighbor better than ourselves, and I like it, said Meg, as they set out their presents while their mothe r was upstairs collecting clothes for the poor Hummels. Not a very splendid show, but there was a great deal of love done up inster an encouraging pat on the shoulder as they parted for the day, each going a different way, each hugging her little warm turnover, and each trying to be cheerful in spite of wintry weather, hard work, and the unsatisfied desires of pleasure loving youth. When Mr. March lost his property in trying to help an unfortunate friend, the two oldest girls begged to be allowed to do something toward their ow n support, at least. Believing that they could not begin too early to cultivate energy, industry, and independence, their parents consented, and both fell to work with the hearty good will which in spite of all obstacles is sure to succ eed at last. Margaret found a place as nursery governess and felt rich with her small salary. As she said, she was `fond of luxury 39。 ever since she was born. That was a very happy breakfast, though they didn39。m so glad, for mine is the handsomest now. Another bang of the street door sent the basket under the sofa, and the girls to the table, eager for breakfast
點(diǎn)擊復(fù)制文檔內(nèi)容
公司管理相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖片鄂ICP備17016276號-1