RPCC digital currency
RPC (remote procere call) is a kind of remote procere call. It is a protocol that requests service from remote computer program through network without knowing the underlying network technology
RPC assumes the existence of some transport protocols, such as TCP or UDP, to carry information and data between communication programs. In the OSI network communication model, RPC spans the transport layer and application layer. RPC makes it easier to develop applications including network distributed multiprogrammingRPC adopts client / server mode. The requester is a client and the service provider is a server. First, the client calls the process, sends a call information with process parameters to the service process, and then waits for the response information
extended data:
specific application operation
1. Inter process communication of distributed operating system
is one of the basic facilities that the operating system must provide. Distributed operating system must provide communication mechanism between processes distributed on heterogeneous node computers, RPC is one of the means to realize distributed interprocess communication in message transfer mode
Because of the geographical distribution of distributed software environment itself, there are a lot of interaction and communication among its components, and RPC is one of its basic implementation methods. Two popular distributed computing software environments, onc + and DCE, are constructed by RPC, and some other distributed software environments also use RPC In the distributed database system, the database generally resides on the server, and the client accesses the database server through the remote database service function. The existing remote database service uses RPC mode. For example, both Sybase and Oracle provide stored procere mechanism. The system and user-defined stored procere are stored on the database server, and the user calls the stored procere in RPC mode on the clientabbr. 中华人民共和国People's Republic of China
a、c、d、f、j、i、n、r、l、m、n、o、g、h、k中o不含有元音音素
RPC is the abbreviation of remote procere call. In fact, the principle of RPC call in SAP system is very simple. There are some C / s systems similar to three-tier architecture. The third-party client program calls SAP internal standard or user-defined functions through the interface to obtain the data returned by the functions and display or print them after processing
Interprocess communication (IPC) is a communication technology used by programs and processes running between multitasking operating systems or networked computers. There are two types of interprocess communication (IPC)local procere call (LPC) LPC is used in a multitasking operating system to enable simultaneous tasks to talk to each other. These tasks share memory space to synchronize tasks and send information to each other. Remote procere call (RPC) RPC is similar to LPC, only works on the Internet. RPC began to appear in Sun Microsystems and HP's computers running UN IX operating system
extended data
through IPC and RPC, programs can use other programs or computer processing processes. The client / server computing model takes remote procere call as a mechanism of inter system communication together with other technologies (such as message passing). Clients perform their own tasks, but rely on the server to provide back-end file services
RPC provides a communication mechanism for clients to apply for services from back-end servers, as shown in figure R-4. If you think of the client / server application as a separate program, the server can run the data access part because it is closest to the data, and the client can run the front-end part of data representation and user interaction. In this way, remote procere call can be regarded as a component to reorganize the divided program through the network. LPC is sometimes called coupling mechanism
in this way, when users want to access data, they don't need to the whole database or most of its programs to the user system each time. In fact, the server only processes requests, even performs some data calculations, and sends the results to users. Because when the data is stored in one place, database synchronization is easy to achieve, so multiple users can access the same data at the same time
Distributed computing environment is composed of a communication system network connected computer cluster. It's easy to see the network as a computing platform. If it's peer-to-peer, any computer can be a client or serversome processing tasks can be divided into independent programs running in parallel on different network computers, and independent programs are handed over to the most suitable computer for this task. This strategy can make use of computer idle resources and improve the efficiency of the network. A typical enterprise network includes many heterogeneous computer systems running different operating systems
we can separate RPC framework into four layers: RPC physical communication layer,
RPC communication protocol layer, RPC connection session layer and RPC application layer< A. RPC physical communication layer, according to the actual use can choose the appropriate physical communication protocol:
1)< It can use UDP network communication protocol, but it is necessary to maintain the data packet timing, packet loss retransmission, to
and virtual connection status. Although using UDP is relatively troublesome, UDP also has many advantages,
such as relatively easy NAT penetration, complete data per packet and so on< SHM shared memory communication can be used for RPC calls between different processes on the same host, with the advantages of fast transmission speed and the disadvantages of only running on the same host< The third-party communication mole interface can be used, such as Bluetooth, serial port, USB connection interface, etc. The advantage is that it can
call each other across terminal devices, and the disadvantage is that it is subject to the third-party communication mole interface
B. the RPC communication protocol layer is the message packet definition of both sides of communication and the data organization of each message. It only needs to be responsible for the data flow of sending and receiving. The physical communication layer is responsible for how to send and receive data
1). Message packet = & lt; Header & gt; +[ That is to say, a message packet is composed of a message header and a message body< The message header must contain: message package ID, message type, message body length, function ID and call return code< However, the size of the header should not be too large,
otherwise, the call cost of RPC will be greater< There are at least the following message types:
A) heartbeat, including request and response
b) connection handshake, including request and response
C)
d). Log out of the application, including request and response
e). Get the definition set, including request and response, that is, read the function definition set of the logged in application< Call function, including request and response
G). Function cancellation means to cancel the submitted function call request
H)
I). Send data to extend RPC to packet communication< The RPC connection session layer is responsible for the connection state management of both sides of the communication, including the following aspects:
1)
2)< The function definition set provided by the opposite application can be obtained by logging in to the application. The function can be called only when the parameter and return value of the function are known. The function definition is the precondition of serialization / deserialization of the parameter and return value
4)
5)
6). It manages the buffer queue of sending packets and the processing of receiving packets
D. the RPC application layer is responsible for the function definition in the application, managing the login and logout of the connection, and allocating the function call request
1). In the function definition, the data types of function parameters and return values should be enough. Different data types can be
to facilitate data display and increase the flexibility of RPC framework. At the same time, the
type of function callback called by RPC should support multiple calling methods, which can be applied to more development languages
2). The function call request can only be accepted after the connection logs in to the application. When the connection logs out of the application, all the function call requests of this
connection will be cancelled automatically
3). The application needs to manage the running thread to execute the allocated function call request.
RPC language: remote procere calls (RPC language)
is a protocol that programs can use to request services from programs on another computer in the network. Because the program using RPC does not need to know the network protocol supporting communication, RPC improves the interoperability of the program. In RPC, the program that makes the request is the client program, while the program that provides the service is the server
RPC (remote procere call) is a technology widely used to support distributed applications (applications with different components distributed on different computers). The main purpose of RPC is to provide a way for components to communicate with each other, so that these components can send requests to each other and pass the results of these requests.
remote procere calls
remote procere calls (RPC) is a protocol that programs can use to request services from programs on another computer in the network. Because the program using RPC does not need to know the network protocol supporting communication, RPC improves the interoperability of the program. In RPC, the program that makes the request is the client program, while the program that provides the service is the server
RPC (remote procere call) is a technology widely used to support distributed applications (applications with different components distributed on different computers). The main purpose of RPC is to provide a way for components to communicate with each other, so that these components can send requests to each other and pass the results of these requests
= = = = = = = = =
CS structure is client / server (client / server)
C / S is also called client / server or client / server mode. The server usually uses high-performance PC, workstation or minicomputer, and uses large database system, such as Oracle, Sybase, Informix or SQL server. The client needs to install special client software
the advantage of C / S is that it can give full play to the processing power of the client PC, and a lot of work can be submitted to the server after being processed by the client. The corresponding advantage is that the client response speed is fast. The disadvantages are as follows:
only applicable to LAN. With the rapid development of the Internet, mobile office and distributed office become more and more popular, which requires our system to have scalability. This way of remote access needs special technology, and at the same time, it needs special design of the system to deal with distributed data
the client needs to install special client software. First of all, it involves the workload of installation. Secondly, if any computer has problems, such as virus and hardware damage, it needs to be installed or maintained. Especially when there are many branches or stores, it's not a matter of workload, it's a matter of distance. In addition, when the system software is upgraded, each client needs to be re installed, and its maintenance and upgrade costs are very high
there are also restrictions on the operating system of the client. It may work with Win98, but not with WIN2000 or Windows XP. Or not suitable for Microsoft's new operating system and so on, let alone Linux, UNIX and so on
= = = = = = = = =
an application uses RPC to% 26quo; Remote% 26quot; Execute a procere in a different address space, and the effect is the same as executing a local call. In fact, an RPC application is divided into two parts: server and client. Server provides one or more remote proceres; The client makes a remote call to the server. Server and client can be on the same computer, or on different computers, or even on different operating systems. They communicate over the Internet. The corresponding stub and operation support provide data conversion and communication services to shield different operating systems and network protocols. Here RPC communication is synchronous. Thread can be used for asynchronous call
in the RPC model, as long as the client and server have the corresponding RPC interface and RPC running support, they can complete the corresponding interoperability without being limited to a specific server. Therefore, RPC provides strong support for client / server distributed computing. At the same time, remote procere call RPC provides service access based on process. The client connects directly with the server, and there is no intermediate mechanism to process the request, so it has certain limitations. For example, RPC usually needs some network details to locate the server; When the client makes a request, the server must be active, etc.
note: a protocol that requests services from a remote computer program over a network without knowing the underlying network technology. RPC assumes the existence of some transport protocols, such as TCP or UDP, to carry information and data between communication programs. In the OSI network communication model, RPC spans the transport layer and application layer. RPC makes it easier to develop applications including network distributed multiprogramming
RPC adopts client / server mode. The requester is a client and the service provider is a server. First, the calling process sends a call information with process parameters to the service process, and then waits for the response information. On the server side, the process keeps sleeping until the call information arrives. When a calling message arrives, the server obtains the process parameters, calculates the result, sends the reply information, and then waits for the next call information. Finally, the client call process receives the reply information, gets the process result, and then calls the execution to continue. At present, there are many RPC modes and implementations. It was originally proposed by sun. The sun version of IETF onc charter is revised to make the onc PRC protocol the IETF standard protocol. The most popular mode and execution is open software based distributed computing environment (DCE).
you'd better kill the virus first
you can try the following methods:
1. Go to buy a magazine of the latest issue of "computer fans" or "netizens world", both of which have a CD attached with antivirus and self boot function
2. Set the CD-ROM drive as the first boot device in BIOS Press the delete key when the computer starts)
if the BIOS has been set to start the CD-ROM drive, it will enter the main interface of the emergency part. If not, you need to press del key to enter BIOS at startup
Phoenix BIOS: boot → select the CD-ROM drive with the cursor → press the + sign on the keypad to make the CD-ROM drive rise to the first position
Phoenix award BIOS: Advanced BIOS Setup → first boot device is set to CD-ROM
ambiios: Advanced BIOS features → boot device select → 1st to CD-ROM
Press F10 to save the settings and restart the computer
3. When prompted to start from CD, press any key to start maintenance CD
4. Select anti-virus in the entry interface and clear the computer completely: select "Jiangmin anti-virus software DOS anti-virus companion" with the mouse
use the mouse or number key 1 and click enter to run Jiangmin DOS anti-virus companion. Every month, the magazine will update the latest virus library before sealing
this software can detect and kill viruses in DOS. Use the mouse or Alt + letters to set the scan file type of antivirus software. Press a, C, D, etc. to select the hard disk to scan
note that if the system boot file and other important files are infected with the virus, the system may not be started e to the file damage. This is because the virus damaged the windows system files, you need to re install the system or repair the system. This CD has no system installation function. Please use your own system installation disk to install or repair the system
5. If there is a virus, it should be normal to restart after killing the virus.
http://www.cppblog.com/jb8164/archive/2009/10/14/48368.html
Step 1: write IDL (interface description language, IDL is a common instry standard language, which should be familiar to everyone, because it is also used to describe interfaces in com< br />Hello.idl:
[
uuid(" 4556509F-618A-46CF-AB3D-ED736ED66477"), // The unique UUID is generated by guidgen
Version (1.0)
]
interface HelloWorld
{
/ / the method we defined
void hello ([in, string] const char * PSZ)< br /> void Shutdown(void);
}
an optional file is the application configuration file (. ACF), which is used to configure the RPC interface. For example, the following hello.acf file:
hello.acf:
[
implicit_ handle(handle_ t HelloWorld_ Binding)
]
interface HelloWorld
{
}
implicit is defined above_ Handle, so that the client will bind the handle HelloWorld_ Binding, as we'll see in the client code later<
compile IDL file:
& gt; midl Hello.idl
Microsoft (R) 32b/64b MIDL Compiler Version 6.00.0366
Copyright (c) Microsoft Corporation 1991-2002. All rights reserved.
Processing .\ Hello.idl
Hello.idl
Processing .\ Hello. ACF
hello. ACF
we can see that hello. H, hello_ s.c, Hello_ c. These are called RPC stub programs, but we can ignore this concept,
we just need to know that there is a
external RPC defined in hello. H_ IF_ HANDLE HelloWorld_ v1_ 0_ s_ ifspec;
this RPC_ IF_ Handle will be used later<
Step 2: write the server program
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -. The code is as follows:
server. C
? Include & lt; stdlib.h>< br />#include < stdio.h>< br />#include " Hello.h" // Reference the header file generated by midl
/ *
* this is the interface method we defined in IDL
* note that the declaration in IDL is void hello ([in, string] const char * PSZ)
* but it becomes const unsigned char *, why
* see midl command line reference - & gt/ Char switch
* the default compilation option is to process the char in IDL as an unsigned char
* /
void hello (const unsigned char * PSZ)
{
printf & quot;% s\ n", psz);
}
/ * * this is also the interface method defined in IDL, which provides a mechanism to shut down the server * /
void shutdown (void)
{
/ / the following operation will cause rpcserverlisten() to exit
rpcmgtstopserverlistening (null)< br /> RpcServerUnregisterIf(NULL, NULL, FALSE);<
}
int main (int argc, char * argv])
{
/ / uses named pipe as the RPC channel, so that the endpoint parameter is the name of named pipe
/ / according to the naming specification of named pipe, & # 92; pipe\ Pipename, where pipename can be in addition to & 92
/ / any character other than, then a guid string is used to name it here to ensure that it will not repeat
rpcserver useprotseqep ((unsigned char *) & quot; ncacn_ np", 20, (unsigned char *)" 92; 92; pipe\ 92;{ 8dd50205-3108-498f-96e8-dbc4ec074cf9}", NULL);
/ / registration interface, HelloWorld_ v1_ 0_ s_ Ifspec is defined in the midl generated hello. H
rpcserverregisterif (HelloWorld)_ v1_ 0_ s_ ifspec, NULL, NULL);
/ / start listening, this function will always block
rpcserverlisten (1,20, false)< br /> return 0;
}
/ / the following functions are written to meet the needs of links. If not, link errors will appear
void__ RPC_ FAR* __ RPC_ USER midl_ user_ allocate(size_ t len)
{
return(malloc(len));< br />}
void __ RPC_ USER midl_ user_ free(void __ RPC_ FAR *ptr)
{
free(ptr);<
}
compile:
& gt; cl /D_ WIN32_ WINNT=0x500 server.c Hello_ s. C rpcrt4. Lib
Microsoft (R) 32-bit C / C + + optimized compiler for 80x86 version 14.00.50727.42
Copyright (c) Microsoft Corporation. All rights reserved< br />
server.c
Hello_ s. C
generating code...
Microsoft (R) incremental linker version 8.00.50727.42
Copyright (c) Microsoft Corporation. All rights reserved.
/ out:server.exe
server.obj
Hello_ s. Obj
rpcrt4. Lib
why should I specify it at compile time_ WIN32_ WinNT = 0x500? If not, the following error will be reported:
hello_ s. C (88): fatal error C1189: # error: you need a Windows 2000 or later to
run this stub because it uses these features:
Step 3: write the client program
--- the client code:
client. C
# include & lt; stdlib.h>< br />#include < stdio.h>< br />#include < string.h>< br />#include " Hello.h" // The header file generated by midl is referenced
int main (int argc, char * argv) []
{
unsigned char * pszstringbinding = null< br /> if ( argc != 2 )
{
printf(" Usage:%s < Hello Text> 92; n", argv[0]);< br /> return 1;
}
/ / use named pipe as RPC channel. Please refer to the section of rpcserveruseprotseqep() in server. C
/ / if the third parameter networkaddr is null, then it is to connect to the local service
/ / otherwise, it is to take & # 92 92; 92; 92; The format of servername, for example, if your computer name is Jack, then it is & # 92 92; jack
RpcStringBindingCompose( NULL, (unsigned char*)" ncacn_ np", /*( unsigned char*)" 92; 92; 92; 92; servername"*/ NULL, (unsigned char*)" 92; 92; pipe\ 92;{ 8dd50205-3108-498f-96e8-dbc4ec074cf9}", NULL, &pszStringBinding );
/ / binding interface, which should be consistent with the configuration of hello.acf, is HelloWorld_ Binding
RpcBindingFromStringBinding(pszStringBinding, & HelloWorld_ Binding );
/ / the following is the call to the server function
rpctryexcept
{
if (_ stricmp(argv[1], " SHUTDOWN") == 0 )
{
Shutdown();< br /> }
else
{
Hello((unsigned char*)argv[1]);< br /> }
}
RpcExcept(1)
{
printf( " RPC Exception %d\ n", RpcExceptionCode() );
}
rpcendexept
/ / release resources
rpcstringfree & pszstringbinding< br /> RpcBindingFree(&HelloWorld_ Binding);< br /> return 0;
}
/ / the following functions are written to meet the needs of links. If not, link errors will appear
void__ RPC_ FAR* __ RPC_ USER midl_ user_ allocate(size_ t len)
{
return(malloc(len));< br />}
void __ RPC_ USER midl_ user_ free(void __ RPC_ FAR *ptr)
{
free(ptr);<
}
compile:
& gt; cl /D_ WIN32_ WINNT=0x500 client.c Hello_ c. C rpcrt4. Lib
Microsoft (R) 32-bit C / C + + optimized compiler for 80x86 version 14.00.50727.42
Copyright (c) Microsoft Corporation. All rights reserved< br />
client.c
Hello_ c. C
generating code...
Microsoft (R) incremental linker version 8.00.50727.42
Copyright (c) Microsoft Corporation. All rights reserved.
/ out:client.exe
client.obj
Hello_ c. Obj
rpcrt4. Lib
Step 4: Test:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
run client.exe:
& gt; Client Hello
you can see the string of hello in the console window of server.exe< br />
> Client shutdown
server.exe exits.
/ /char bstr[strlen(str)];/ Exchange area
< memset (bstr.0,sizeof(bstr);< br/>
> for(int i = 0; i < strl(str); i++) {
< if(! strncmp(str+i,oldstr,strlen(oldstr){// Find target characters consisting of a channel
/ /strcat(bstr,newstr);< br/ > = i + strl(oldstr) -1; < / Preservation of a section of the suspension area
> }
}