Sunteți pe pagina 1din 15

REMOTE INVOCATION

• Request-reply protocols represent a pattern on


top of message passing.
• It support the two-way exchange of messages
as encountered in client-server computing.
• low-level support – execution of remote
operation
• direct support for RPC and RMI

1
• RPC which allows client programs to call
procedures transparently in server programs
running in separate processes and generally in
different computers from the client.
• In the 1990s, the object-based programming
model was extended to allow objects in
different processes to communicate with one
another by means of remote method
invocation (RMI).

2
3
Request-reply protocols
• Designed to support the roles and message
exchanges in typical client-server interactions.
• Types of communication
Synchronous – until reply arrives from the
server
Asynchronous - clients can afford to retrieve
replies later

4
Client – server operation
• Send
• receive
Implements
• Acknowledgements are redundant
• Establishing a connection
• Flow control is redundant

5
Request-reply protocol
doOperation
• clients to invoke remote operations
public byte[] doOperation (RemoteRef s, int
operationId, byte[] arguments)
getRequest
• server process to acquire service requests
public byte[] getRequest ();
sendReply
• send the reply message to the client
public void sendReply (byte[] reply, InetAddress
clientHost, int clientPort); 6
7
• Message identifiers
requestId
identifier for the sender process
• Failure model of the request-reply protocol
doOperation
getRequest
sendReply
• They suffer from omission failures.
• Messages are not guaranteed to be delivered
in sender order.

8
Action taken
• Timeouts
• Discarding duplicate request messages
• Lost reply messages
Styles of exchange protocols
• request (R) protocol;
• request-reply (RR) protocol;
• request-reply-acknowledge reply (RRA)
protocol.

9
10
Example
• Hypertext Transfer Protocol (HTTP) used by
web browser clients to make requests to web
servers and to receive replies from them.
Data (text of an HTML page, an image or the
class )
Program (PHP or Python programs)

11
• Set of methods
 GET
 PUT
POST
• Addition method
content negotiation
password-style authentication
• HTTP is implemented
port specified in the URL.
client sends a request message
server sends a reply message
connection is closed 12
HTTP Request message

13
HTTP methods
• GET - URL is given as its argument
• HEAD - identical to GET
• POST - Specifies the URL of a resource
• PUT - data supplied in the request
• DELETE - deletes the resource identified by
the given URL
• OPTIONS – allow GET, HEAD, PUT
• TRACE - server sends back the request
message 14
Message contents
• GET /index.html HTTP/1.1
• Host: www.dcs.qmul.ac.uk

15

S-ar putea să vă placă și