CN103823659A - Communication multithreading technology - Google Patents
Communication multithreading technology Download PDFInfo
- Publication number
- CN103823659A CN103823659A CN201210464769.XA CN201210464769A CN103823659A CN 103823659 A CN103823659 A CN 103823659A CN 201210464769 A CN201210464769 A CN 201210464769A CN 103823659 A CN103823659 A CN 103823659A
- Authority
- CN
- China
- Prior art keywords
- interface
- thread
- service
- class
- wcf
- Prior art date
- Legal status (The legal status 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 status listed.)
- Pending
Links
Landscapes
- Communication Control (AREA)
Abstract
The invention discloses a communication multithreading technology which includes the steps of firstly, defining a WCF service contract, and building a WCF service project; secondly, realizing a WCF service, and building a class inheritance WCF service interface; thirdly, defining a delegation class, and declaring at the location of a delegation event; fourthly, starting the WCF service; fifthly, using the delegation event, declaring the class of a WCF service delegation message, and declaring the delegation event of an interface thread; sixthly, guiding into a thread pool, and opening another thread. The communication multithreading technology has the advantages that cross-platform communication can be achieved; coding methods are high in readability and easy to expand; large amount of If-Else (Switch) statement used in a program can be avoided; program stability and stable communication among threads are achieved; program quality and efficiency are increased.
Description
Technical field
The present invention relates to a kind of mechanics of communication, what be specifically related to is a kind of communication multithreading.
Background technology
Mechanics of communication:
WCF:Windows Communication Foundation (WCF) is the application development interface of one group of data communication being developed by Microsoft, it is a part for NET framework, started to introduce by NET Framework 3.0, with three major application program development class libraries of Windows Presentation Foundation and Windows Workflow Foundation behavior a new generation's Windows operating system and WinFX.In NET Framework 2.0 and front version, Microsoft has developed Web Service (SOAP with HTTP communicatio), the communications such as the Winsock on NET Remoting (TCP/HTTP/Pipeline communication) and basis are supported, due to the method for designing difference of each communication means, and (for example NET Remoting can develop SOAP also each other mutual plyability, HTTP communication), for developer, different selections has different programming models, and must relearn, allow developer in use have much inconvenience.Simultaneously, Service-Oriented Architecture Based (Service-Oriented Architecture) also starts prevailing in software industry, therefore Microsoft has checked these communication meanss again, and design a unified program development model, provide substantially the most resilient support for data communication, Here it is Windows Communication Foundation.
Trust is a class, it has defined the type of method, the parameter that method can be used as to another method is transmitted, this way that method is dynamically assigned to parameter, can avoid a large amount of If-Else (Switch) of use statements in program, make calling program there is better extensibility simultaneously.
Thread pool is a kind of multithreading processing form, in processing procedure, adds task to queue, then after establishment thread, automatically starts these tasks.Thread pool thread is all background thread. each thread uses the storehouse size of acquiescence, with the priority operation of acquiescence, if and in multiple thread units. certain thread is idle (as waited for certain event) in Managed Code, if thread pool makes all processors keep busy another worker thread of insertion. all thread pool threads all remain busy, but in queue, comprise the work of hang-up, thread pool will create another worker thread but the number of thread exceedes maximal value never over time. and exceeding peaked thread can queue up, but they will wait until after other threads complete and just start.
Summary of the invention
The object of the invention is to overcome the above problem that prior art exists, a kind of many communications multithreading is provided, communication skill is used flexibly, make the simple of Multi-thread Communication reading and writing data change.
For realizing above-mentioned technical purpose, reach above-mentioned technique effect, the present invention is achieved through the following technical solutions:
A kind of communication multithreading, step is as follows:
The contract of step 1) definition WCF service, sets up the engineering of a WCF service, states a contract interface, introduces the attribute of contract definition and interface function, the call back function of definition asynchronous interface;
Step 2) realize WCF service, set up a class and inherit WCF service interface, before class, there is statement, realize interface function, message informing is stated to a synchronous stage signal before to interface, then call callback method by described signal;
Class is entrusted in step 3) definition, states in the place of commit event, and described statement comprises parameter and the title of entrusting Message function;
Step 4) starts WCF service by host's mode, state a WCF service object, then protocol parameter and service parameter are set, and definition bindtype is ICP/IP protocol, and maximum byte number, transmission time-out time, contract class, COS, the wcf address of service of receiving is set;
Step 5) is used commit event, and the class of message is entrusted in statement WCF service, the commit event of statement interface thread;
Step 6) is introduced thread pool, and separately opens a thread, and statement thread also arranges thread parameter.
The invention has the beneficial effects as follows:
1, realize cross-platform communication;
2, code method reading property is strong, easily expansion;
3, can avoid a large amount of If-Else (Switch) of use statements in program;
4, program stability is strong, cross-thread communication robust;
5, in the quality of program and efficiency, be all improved.
Embodiment
Below in conjunction with embodiment, describe the present invention in detail.
A kind of communication multithreading, step is as follows:
The contract of step 1) definition WCF service, sets up the engineering of a WCF service, states a contract interface, introduces the attribute of contract definition and interface function, the call back function of definition asynchronous interface;
Step 2) realize WCF service, set up a class and inherit WCF service interface, before class, there is statement, realize interface function, message informing is stated to a synchronous stage signal before to interface, then call callback method by described signal;
Class is entrusted in step 3) definition, states in the place of commit event, and described statement comprises parameter and the title of entrusting Message function;
Step 4) starts WCF service by host's mode, state a WCF service object, then protocol parameter and service parameter are set, and definition bindtype is ICP/IP protocol, and maximum byte number, transmission time-out time, contract class, COS, the wcf address of service of receiving is set;
Step 5) is used commit event, and the class of message is entrusted in statement WCF service, the commit event of statement interface thread;
Step 6) is introduced thread pool, and separately opens a thread, and statement thread also arranges thread parameter.
Claims (1)
1. a communication multithreading, is characterized in that, step is as follows:
The contract of step 1) definition WCF service, sets up the engineering of a WCF service, states a contract interface, introduces the attribute of contract definition and interface function, the call back function of definition asynchronous interface;
Step 2) realize WCF service, set up a class and inherit WCF service interface, before class, there is statement, realize interface function, message informing is stated to a synchronous stage signal before to interface, then call callback method by described signal;
Class is entrusted in step 3) definition, states in the place of commit event, and described statement comprises parameter and the title of entrusting Message function;
Step 4) starts WCF service by host's mode, state a WCF service object, then protocol parameter and service parameter are set, and definition bindtype is ICP/IP protocol, and maximum byte number, transmission time-out time, contract class, COS, the wcf address of service of receiving is set;
Step 5) is used commit event, and the class of message is entrusted in statement WCF service, the commit event of statement interface thread;
Step 6) is introduced thread pool, and separately opens a thread, and statement thread also arranges thread parameter.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201210464769.XA CN103823659A (en) | 2012-11-19 | 2012-11-19 | Communication multithreading technology |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201210464769.XA CN103823659A (en) | 2012-11-19 | 2012-11-19 | Communication multithreading technology |
Publications (1)
Publication Number | Publication Date |
---|---|
CN103823659A true CN103823659A (en) | 2014-05-28 |
Family
ID=50758747
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201210464769.XA Pending CN103823659A (en) | 2012-11-19 | 2012-11-19 | Communication multithreading technology |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN103823659A (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105354015A (en) * | 2014-08-20 | 2016-02-24 | 南京普爱射线影像设备有限公司 | Multi-thread communication technology |
CN108494606A (en) * | 2018-04-19 | 2018-09-04 | 四川师范大学 | A kind of data service frame building method based on WCF technology |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7327954B2 (en) * | 2002-05-31 | 2008-02-05 | Fujitsu Limited | Optical signaling to share active channel information |
CN102369523A (en) * | 2009-03-24 | 2012-03-07 | 微软公司 | Monitoring of distributed applications |
CN102760053A (en) * | 2012-06-20 | 2012-10-31 | 东南大学 | Human body detection method based on CUDA (Compute Unified Device Architecture) parallel calculation and WCF framework |
-
2012
- 2012-11-19 CN CN201210464769.XA patent/CN103823659A/en active Pending
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7327954B2 (en) * | 2002-05-31 | 2008-02-05 | Fujitsu Limited | Optical signaling to share active channel information |
CN102369523A (en) * | 2009-03-24 | 2012-03-07 | 微软公司 | Monitoring of distributed applications |
CN102760053A (en) * | 2012-06-20 | 2012-10-31 | 东南大学 | Human body detection method based on CUDA (Compute Unified Device Architecture) parallel calculation and WCF framework |
Non-Patent Citations (5)
Title |
---|
李文滔: "基于WCF架构的应用开发研究", 《计算机时代》 * |
程汤培: "基于WCF的即时通信软件的设计与实现", 《电脑编程技巧与维护》 * |
罗丹等: "遗留系统并行架构的设计与实现", 《计算机应用》 * |
韩旭: "WCF服务宿主迁移方案设计", 《电脑与信息技术》 * |
韩旭等: "基于.NET WCF回调机制的进程间通信设计", 《电脑知识与技术》 * |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105354015A (en) * | 2014-08-20 | 2016-02-24 | 南京普爱射线影像设备有限公司 | Multi-thread communication technology |
CN108494606A (en) * | 2018-04-19 | 2018-09-04 | 四川师范大学 | A kind of data service frame building method based on WCF technology |
CN108494606B (en) * | 2018-04-19 | 2020-12-15 | 四川师范大学 | WCF technology-based data service framework building method |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN101814024B (en) | Framework and tool for designing cross-platform 3D interface | |
KR100989613B1 (en) | Terminal device for executing android application based non-android flatform | |
CN103942823B (en) | A kind of game engine rendering intent and device | |
CN103345405A (en) | Application program starting method and device and client | |
KR20100014823A (en) | Application switching in a single threaded architecture for devices | |
CN101931603A (en) | Method for realizing remote call on hand-held intelligent terminal | |
CN110955499B (en) | Processor core configuration method, device, terminal and storage medium | |
CN101477463A (en) | Software platform and software development platform used for digital television set-top box | |
CN102955704A (en) | Software executing method and electronic device thereof | |
CN103513858A (en) | Remote assistance method and device | |
CN103823659A (en) | Communication multithreading technology | |
CN102141929B (en) | Application program running method, simulator, host machine and system | |
CN106227548A (en) | Method for dynamically displaying and hiding BIOS SETUP option | |
CN102375759B (en) | Utilize the method that finite state machine prevents code rewriting | |
KR101269528B1 (en) | Method of modeling graphically a discrete event system | |
CN105354015A (en) | Multi-thread communication technology | |
CN111352715A (en) | Method, system, terminal and storage medium for destroying flash thread | |
CN204302959U (en) | A kind of hardware real-time operation system | |
CN111143017A (en) | Cloud operating system interaction processing method, client and cloud operating system | |
CN102508665B (en) | Method for drawing application view and device for drawing application view | |
CN105159703A (en) | Factory setting restoration method and system | |
CN102929594A (en) | 3D (3-dimensional) interface implementation method and system based on android system | |
CN106201508B (en) | Information display method and device and electronic equipment | |
WO2014146457A1 (en) | Method and device for processing window task | |
TWI441017B (en) | Portable electronic device and power saving method thereof |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20140528 |
|
RJ01 | Rejection of invention patent application after publication |