Client-Server Communication Sockets Remote Procedure Calls Remote Method Invocation (Java)
Sockets A socket is defined as an endpoint for communication. Concatenation of IP address and port The socket :1625 refers to port 1625 on host Communication consists between a pair of sockets. Considered a low-level form of communication between distributed processes. Sockets allow only an unstructured stream of bytes to be exchanged. It is the responsibility of the client or server application to impose a structure on the data.
Socket Communication
Remote Procedure Calls Remote procedure call (RPC) abstracts procedure calls between processes on networked systems. Stub – client-side proxy for the actual procedure on the server. Server has a similar stub as well. The client-side stub locates the server and marshals the parameters. The server-side stub receives this message, unpacks the marshaled parameters, and performs the procedure on the server. External data representation (XDR) I.e most-significant (big-endian), least-significant(little-endian)
Execution of RPC
Remote Method Invocation Remote Method Invocation (RMI) is a Java mechanism similar to RPCs. RMI allows a Java program on one machine to invoke a method on a remote object.
Marshalling Parameters
Remote Method Invocation RMI and RPC differs in two ways: 1. RPCs support procedural programming whereby only remote procedures or functions may be called. RMI is object based: It supports invocation of methods on remote objects. 2. The parameters to remote procedures are ordinary data structures in RPC; with RMI it is possible to pass objects as parameters to remote methods. If the marshaled parameters are local (non remote) objects, they are passed by copy using a technique known as object serialization. Object serialization allowed the state of an object to be written toa byte stream.