TW200924441A - A method of communication of asynchronous request and response - Google Patents

A method of communication of asynchronous request and response Download PDF

Info

Publication number
TW200924441A
TW200924441A TW96145258A TW96145258A TW200924441A TW 200924441 A TW200924441 A TW 200924441A TW 96145258 A TW96145258 A TW 96145258A TW 96145258 A TW96145258 A TW 96145258A TW 200924441 A TW200924441 A TW 200924441A
Authority
TW
Taiwan
Prior art keywords
request
response
server
communication
communication terminal
Prior art date
Application number
TW96145258A
Other languages
Chinese (zh)
Inventor
Wei Gao
Tom Chen
Win-Harn Liu
Original Assignee
Inventec Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Inventec Corp filed Critical Inventec Corp
Priority to TW96145258A priority Critical patent/TW200924441A/en
Publication of TW200924441A publication Critical patent/TW200924441A/en

Links

Landscapes

  • Telephonic Communication Services (AREA)

Abstract

A method of communication of asynchronous request and response, utilizes to transmit the data between the applications in the server. The method comprise of the steps, opening a socket of the request and a port; setting a object pool for each request for recording the connecting status of each sockets of the request; waiting a response of the server; when the server finish receives the request, the server transmits a reply message to the corresponded socket of the request; searching the corresponded processed event in the object pool according to the reply message. The request uses the socket and port to processes the request and the response, in order to reduce the loading of the server and the request.

Description

200924441 九、發明說明: 【發明所屬之技術領域】 -種請求應答的通信方法,特別是有關於—種應用在舰端 所運行的應用程式,應用程式與請求端間的資訊傳遞之非同步靖 求應答的通信方法。 【先前技術】 在一般的應用程式為了能達到即時反應的處理,所以多會採 用非同步請求應答(Asynchronous reqUestresponse)的機制。非同步 凊求應答可以利用線程輪詢㈣胞幻與回覆(callback)兩種方式來 達請參考「第la圖」與「第lb圖」所示’其係分別為習知 線程監控架構圖與習知線程運作流程圖。 在「第1a圖」中分別具有請求端110與伺服端120。在「負 la圖」的請求端110具有複數個線程(thread)ln。在請求端⑽^ 具有線程111的輪詢機制,其用以監控請求端11G _服端12丨 ^發达的請求應答是否有回應。其情程ηι的輪躺運作方3 ^己合「第山lb圖」所示,其包括下列步驟:請求端發送複細 _ 1=叫步驟S15Q) ’其中每—個請求分卿應設置—個請才 對於—個應用程式而言,在應用程式中可以具軸^ (ready)。^11 _作狀,_]為:運行(_)、阻塞_罐制 π未端對每_請求線程分別的詢問是否已經接收咖服端的 200924441 回應(步驟S160)。若請求已细垃价 二接收到伺服端的回應,請求端判斷 是否持續此-線程(步驟Sm)。若請求端持續此一線程的話,則 重複步驟輸(步驟S171) 請求雜肖滅此—線程(步驟 S172)。 對於線程111 _詢機制而言,·端㈣需要销地對線 程in的輪詢進行資訊的收集和回應,所以會消耗词服端12〇中 ,運算資源(例如,CPU運算或記憶體等)。而且飼服端12〇回摩 ^線程m都需要耗費部分時間同時線程iu都存在輪詢: D所以不可避免的會出現線程m遺漏信息的情況。 另種非同步凊求應合方式,其係利用回覆機制。請參考「第 ’其係為f知回覆運作流程圖。請求端ικ)送出非同步 ==_至伺服端(步驟_。其中,對請求的控 執:二=移轉到請求端的執行環境_ime),並且請求端的 U 4表錄郝請轉翻他端(麵㈣)。本 咖)。伺服端完成遠射叫後,將^驟 會吟叫請求端的執行環境,並從 达的執行結果(步驟㈣)。 ㈣所傳 回__就是,健剌於崎 飼服請内部會加大資源消耗和系统負擔。如果應用於 【發明内容】 200924441 、_以上的問題,本發明社要目的在於提供—種非同步請 求應Q的通彳5方法,彳寸別有關於—種應用在伺服端所運行的應用 程式之資訊傳遞。 ~ 、為達上述目的’本發明所揭露之非同步請求應答的通信方 法’其包括下列步驟:於請求端中建立相應請求應答的通訊端 (socket)與連料㈣,在每—請求端巾分概置物件池㈣⑽ P〇〇1),肋記錄不_财鱗所相麵該通訊端之連線狀態; _服端議求應答;回傳回_至請麵目應的通訊 知;根據回覆訊息查找物件池中之相應的處理事件。 本發财請求財_ 了通訊端麵接料進行翻步請求 二^作’藉以減輕伺服端與請求端騎細程式請求應答的 連線負«並且保_轉㈣料的稍師完整性。 明如^本發哪徵與實作,魏合圖示作最佳實施例詳細說 【實施方式】 本糾糾了-_決储騎請求端畴畔請求應答的 端^^別是對伺服财所運行的應用程式,翻以應答對請求 分二Γ:請參考「第3a圖」與「第3b圖」所示,其係 明之系統架構圖與本發明之運作流程圖。在「第3a圖」 3】^接Ϊ 〇與飼服端320。在請求射包括有物件池 接埠312編313。娜物是,在本發明中並非 200924441 是線程犯的輪詢或遠端呼叫請求來義制步請求應答。 請求端向伺服端中註冊相應的通訊資訊(步驟S4]〇),使得伺 服端根據軌資·以確認請求鶴欲使_通訊端。於請求端 中建立相應請求的通訊端(步驟。步驟s與步驟⑽分 別疋對凊求端310與飼服端32G進行請求及應答的初始化過程。 其=,通訊端(socket)提供一種應用程式間的通信方法,通訊端主 要是用在兩個不同的應用程式間的信息交換。在翻程式中對每 丄個通賴對應⑦置不同的識別碼。所以應用程式間在進行信息 又換%❺方的應贿式可啸據唯—識別碼來建立其通訊管道。 在通訊端巾更建立麵物〇巾312,以供相應的刺程式進行 通訊。較佳的實施方式更可以視請求的數量在每—個通訊端中建 立多個連接埠312來與飼服端進行通訊。 接著’在每—個請求端巾分別設置物件池(。_ _)(步驟 S43〇h利用物件池311記錄每—個請求所相應的通訊端與連接痒 ^之連驗態。麵錢程巾,判_輯與舰叙連線狀熊 ^驟S’。若請求端3】〇與做端划騎線狀態時,通气端 2㈣服端狗出連線要求。剛續執行烟糊 &求端31G與端32〇之連線狀態。 ^飼服端接收請求(步驟S45〇)。當飼服端完成請求時,由 -合回覆訊息至請求端(步驟S·)。特別值得注意的是, ^ 3】0在發送請求給飼服端32〇後,請求端灿就可以進行 200924441 同、式的計算或資源調用。因為词服端320所採用的是非 别㈣32…㈣的妓咖息給請求端 。月求、31〇而是等待—段時間, 月 可以運行其他的應用程式。 、10亚在此-時間中 根據回覆訊息查找物件財是否有相 S470)。芒早二主土、^ 1 '以白〕處理事件(步驟 )右疋明未鳊31〇從物件池311中杳 理事件時,,长 —4 %、回覆訊息的處 。月衣柒310會調用此一處理事件給 用。執行數據清除手段(步驟s …^用程式使 费… )右疋清求端310所接你糾从 回復乳心無法從物件池311 、 .. 一找到相應的處理事件 310一會執行數據清除手段用以清除回覆訊息。請參考「第3 ^ 所不,其係為本發明之線程運作示意圖。 c回」 本發明在請麵巾制了通訊端與連接埠 應答的運作,私減_服端 非同步請求 服嘀興叫求糕間對應用程 連線負載量。並且保證所取得_料的連續性和完整性。-合、 雖然本發明以前述之較佳實施例揭露如上 定本發明,蝴細_者,在侧她I 内,當可倾許之更動翻飾,因財㈣之專利n 本說明書所附之申請專利範圍所界定者為準。 H 員視 【圖式簡單說明】 第la圖係為習知線程監控架構圖。 第〗b圖係為習知線程運作流程圖。 30 200924441 第2圖係為習知回覆運作流程圖。 第3a圖係為本發明之系統架構圖。 第3b圖係為本發明之運作流程圖。 第3c圖係為本發明之線程運作示意圖。 【主要元件符號說明】 110 請求端 111 線程 120 伺服端 310 請求端 311 物件池 312 連接埠 313 線程 320 伺服端200924441 IX. Invention: [Technical field of invention] - A communication method for request response, especially for an application that runs on the ship, the non-synchronization of information transfer between the application and the requester A communication method for responding. [Prior Art] In general applications, in order to achieve immediate response processing, an asynchronous asynchronous response (Asynchronous reqUestresponse) mechanism is used. The asynchronous request response can be obtained by using the thread polling (4) cell illusion and the callback method. Please refer to the "La Figure" and "The lb diagram" as shown in the figure. The flow chart of the conventional thread operation. There are a requester 110 and a server 120 in "1a". The requesting end 110 of the "negative la map" has a plurality of threads ln. At the requesting end (10), there is a polling mechanism of the thread 111, which is used to monitor whether the requesting end of the requesting end 11G _ server 12 发达 ^ is a response. The trajectory of the course ηι is shown in the figure "Third lb diagram", which includes the following steps: the requester sends a multiplex _ 1 = called step S15Q) 'where each request branch should be set - For an application, you can have an axis (ready) in your application. ^11 _ 状, _] is: run (_), block _ cans π end of the query for each request thread has received the 200924441 response of the coffee server (step S160). If the request has received a response from the server, the requester judges whether or not the thread is continued (step Sm). If the requester continues the thread, the step is repeated (step S171) and the request is terminated (step S172). For the thread 111_inquiry mechanism, the end (4) needs to pin the information and collect and respond to the polling of the thread in, so it will consume the computing resources (for example, CPU operation or memory, etc.). . And the feeding service end 12〇 back to the ^ thread m need to spend part of the time while the thread iu has polling: D so inevitably there will be a situation where the thread m missed information. Another type of asynchronous request is to use the reply mechanism. Please refer to "The first part is the flow chart of the reply process. The request side ικ" sends the asynchronous ==_ to the server (step _. Among them, the control of the request: two = transfer to the execution environment of the requester _ Ie), and the U 4 record of the request side, please turn over his end (face (four)). This coffee). After the server completes the long-range call, it will call the execution environment of the request side, and the execution result from the end (Step (4)). (4) The __ is that the health of the 崎 剌 饲 feed will increase the resource consumption and system burden. If applied to the [invention content] 200924441, _ above, the purpose of the invention is to Providing a non-synchronous request to the Q of the 5 method, the information about the application of the application running on the server. ~, for the above purposes, the invention disclosed in the asynchronous request response The communication method includes the following steps: establishing a communication terminal (socket) and a lining (4) of the corresponding request response in the requesting end, and setting the object pool (4) (10) P〇〇1) in each requesting end, the rib record is not _ The connection status of the communication terminal opposite the financial scale; _ The service end asks for a response; it returns to the _ to the face of the communication knowledge; according to the reply message to find the corresponding processing event in the object pool. The fortune request _ the communication end face receives the tumbling request 2 As a way to reduce the connection between the server and the requester, the request is answered by the negative « and the security of the _ turn (four) material is the integrity of the teacher. Mingru ^ 本 征 征 征 本 本 本 本 本 本 本 本 本 本 本 本 本 本 本Say [Implementation] This has been corrected - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ And "Figure 3b", which is a system architecture diagram and a flow chart of the operation of the present invention. In "3a" 3] ^ Ϊ 饲 and feeding end 320. The request shot includes an object pool interface 312, 313. Nao is, in the present invention, 200924441 is not a threaded poll or a remote call request. The requesting end registers the corresponding communication information with the server (step S4] 〇), so that the servo end confirms the request to make the _ communication terminal according to the trajectory. The communication end of the corresponding request is established in the requesting end (step. Step s and step (10) respectively perform the initialization process of requesting and responding to the requesting end 310 and the feeding end 32G. The = terminal provides an application. Inter-communication method, the communication terminal is mainly used for information exchange between two different applications. In the program, each pair of placards corresponds to 7 different identification codes, so the information between the applications is changed again. The party's bribery can be used to establish its communication pipeline based on the identification code. In the communication end towel, a face towel 312 is created for communication by the corresponding stab program. The preferred embodiment can be requested. The number establishes a plurality of ports 312 in each communication terminal to communicate with the feeding end. Then 'set the object pool (.__) in each requesting end towel (step S43〇h records with the object pool 311) Each communication request corresponds to the communication end and the connection itch ^ even the test status. Face money towel, judge _ series and ship Syria connection line bear ^ S S. If the request end 3] 〇 and do the end line In the state, the ventilating end 2 (four) serving the dog out of the line to Just continue to execute the smoke paste & the end 31G and the end 32 〇 connection status. ^ Feeding end receiving request (step S45 〇). When the feeding end completes the request, the reply message is sent to the requesting end ( Step S·). It is particularly noteworthy that ^ 3]0 can send a request to the feeding end 32 ,, then request the end can be used for the calculation of the same type or the resource call of 200924441. Because the word service end 320 is used Yes or No (4) 32... (4) 妓 妓 给 请求 请求 。 月 月 月 月 月 月 月 月 月 月 月 月 月 月 月 月 月 月 月 月 月 月 月 月 月 月 月 月 月 月 月 月 月 月 月 月 月 月 月 月 月 月 月 月 月 月S470). Mang early two main soil, ^ 1 'white] event (step) right 疋 明鳊31〇 from the object pool 311 in the event, long - 4%, reply to the message.柒310 will call this processing event for use. Execute the data clearing means (step s ... ^ use the program to make a fee...) Right 疋 求 求 310 310 310 310 310 310 310 310 310 310 310 310 310 310 310 310 310 310 310 310 310 310 310 310 310 310 310 310 310 310 310 310 310 310 310 310 310 310 310 310 310 310 310 310 310 310 310 310 310 310 310 310 310 310 310 310 310 310 310 310 310 310 310 310 The corresponding processing event 310 will perform a data clearing method to clear the reply message. Refer to "3^^, which is a schematic diagram of the thread operation of the present invention. c back" The present invention makes the operation of the communication terminal and the connection response in the face towel, private reduction _ server-side asynchronous request service 嘀The amount of load on the application line is determined, and the continuity and integrity of the obtained material are ensured. Although the present invention is disclosed in the above preferred embodiment, the present invention is as described above. In the case of I, when the pledge is changed, the patent of the financial (4) is defined by the scope of the patent application attached to this specification. H 者 [Simplified description of the drawing] The first picture is the conventional thread monitoring Architecture diagram. The diagram is a flow chart of the conventional thread operation. 30 200924441 Figure 2 is a flow chart of the conventional reply operation. Figure 3a is a system architecture diagram of the present invention. Figure 3b is a flow chart of the operation of the present invention. Figure 3c is a schematic diagram of the thread operation of the present invention. [Main component symbol description] 110 Requester 111 Thread 120 Servo terminal 310 Request side 311 Object pool 312 Connection 埠 313 Thread 320 Server

Claims (1)

200924441 十、申請專利範園·· L 求應答的通信方法,應用在-伺服端所運行的複 該非时應用程朗以接收複數個請求端之—請求, D / @、心、合方法包括下列步驟: 於該請求端中建立相應該 請求的一通訊端(socket)與 連結埠(port); 以請求端中分別設置-物件池㈣⑽P。。】) 二〜,求所相應的該通訊端之連線狀態; 等待該伺服端接收該些請求; " 1當該飼服端完成該些請求時,由該飼服端 訊息至該請求端;以及 根據該回覆訊息查找該物件池中之相 用 應答一回覆 件。 應的一處理事 2. 如申請專利範圍第】項所述之非同步請求應答的輕 中在該請求端發送請求前,更包 ’、 服端中Li日Μ 下列步驟:該請求端向_ 服私中在冊相應的一通訊資訊,伸 使侍該伺服端根據該 訊用以確認該請求端所欲使用的該通訊端。 、 3. 如申請專利範圍第1項所述之非同 方法,其 步睛4應答的通作 中該查找物件池之步驟後更包括: ° 若是該請求端所接收到的回覆 查找到相應的處理事件時,執 δί1息無法從該物件池中 亍數據清除手段,用以清 12 200924441 除該些回覆訊息。 4.如申請專利範圍第1項所述之非同步請求應答的通信方法,其 中在建立該通訊端後,更包括下列步驟: 若該通訊端與該伺服端係為離線狀態時,該通訊端重 新向該伺服端發出連線要求。 13200924441 X. Applying for a patent garden · · L The communication method for answering is applied to the application of the non-time application running on the server to receive a plurality of request terminals. The request, D / @, heart, and method include the following Step: In the requesting end, a communication terminal (port) and a link port corresponding to the request are established; and the object pool (4) (10)P is respectively set in the requesting end. . 】) 2~, find the corresponding connection status of the communication terminal; wait for the server to receive the requests; " 1 When the feeding end completes the requests, the feeding end message to the requesting end And finding a response to the response in the object pool based on the reply message. The following should be handled as follows: 2. The request for the asynchronous request response described in the scope of the patent application is sent to the requester, and the package is followed by the following steps: The request is directed to _ The corresponding communication information in the private book is extended to enable the server to confirm the communication terminal to be used by the requesting terminal according to the message. 3. If the non-identical method described in item 1 of the patent application is applied, the step of finding the object pool in the step 4 response is further included: ° If the response received by the requesting end finds the corresponding processing At the time of the event, the δί1 information cannot be used to clear the data from the object pool, in order to clear the 12 200924441 except for the reply messages. 4. The communication method of the asynchronous request response according to claim 1, wherein after the communication terminal is established, the method further comprises the following steps: if the communication terminal and the server are offline, the communication terminal Re-send the connection request to the server. 13
TW96145258A 2007-11-28 2007-11-28 A method of communication of asynchronous request and response TW200924441A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
TW96145258A TW200924441A (en) 2007-11-28 2007-11-28 A method of communication of asynchronous request and response

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
TW96145258A TW200924441A (en) 2007-11-28 2007-11-28 A method of communication of asynchronous request and response

Publications (1)

Publication Number Publication Date
TW200924441A true TW200924441A (en) 2009-06-01

Family

ID=44729007

Family Applications (1)

Application Number Title Priority Date Filing Date
TW96145258A TW200924441A (en) 2007-11-28 2007-11-28 A method of communication of asynchronous request and response

Country Status (1)

Country Link
TW (1) TW200924441A (en)

Similar Documents

Publication Publication Date Title
US9537786B2 (en) Method, device, and system for information processing based on distributed buses
WO2021031473A1 (en) Blockchain asset processing method based on multiple asset models and related device
CN110998554B (en) Real-time cloud-based messaging system
US9967360B2 (en) Method and system for information exchange utilizing an asynchronous persistent store protocol
CN111368173A (en) File transmission method and device, electronic equipment and readable storage medium
US20120166556A1 (en) Method, device and system for real-time publish subscribe discovery based on distributed hash table
CN113259415B (en) Network message processing method and device and network server
CN106254206A (en) A kind of information processing method and equipment
CN108551477B (en) Data transmission channel establishing system, network storage device, server and method
WO2024067529A1 (en) Rdma-based link establishment method and apparatus, and device and storage medium
TW200924441A (en) A method of communication of asynchronous request and response
US20090198768A1 (en) Asynchronous request-response communication method
CN112165597B (en) Data approval method and device based on multiparty video
CN112954068B (en) RDMA (remote direct memory Access) -based data transmission method and device
CN112822299B (en) RDMA (remote direct memory Access) -based data transmission method and device and electronic equipment
KR20170116941A (en) System and method of piggybacking target buffer address for next rdma operation in current acknowledgement message
CN114020412A (en) Message processing method, device, equipment and storage medium
CN112383904A (en) Pair-free quick peripheral calling method and device
CN101452398B (en) Asynchronous request and response communication method
CN108932624A (en) User information mapping method and server, computer readable storage medium
KR100282616B1 (en) Structure and Processing Method of Multiprotocol Gateway for Web and Applications
CN114679435B (en) Session management system, method, computer device and storage medium
TW202307681A (en) Broker service for multiple protocols
CN115695490A (en) Method and device for transferring data, electronic equipment and vehicle
CN116155971A (en) Multiplexing network data transmission method and system based on TCP