Tuesday, April 10, 2012

Communication in Client-Server Systems

3.6 Communication in Client-Server Systems


  • 3.6.1 Sockets

A socket is an endpoint for communication.
Two processes communicating over a network often use a pair of connected sockets as a communication channel

Software that is designed for client-server operation may also use sockets for communication between two processes running on the same computer - For example, the UI for a database program may communicate with the back-end database manager using sockets.

A socket is identified by an IP address concatenated with a port number, e.g. 200.100.50.5:80.
Sockets are considered a low-level communications channel

Communication channels via sockets may be of one of two major forms,
1-Connection-oriented ( TCP, Transmission Control Protocol )
2-Connectionless ( UDP, User Datagram Protocol )



  • 3.6.2 Remote Procedure Calls, RPC

The general concept of RPC is to make procedure calls similarly to calling on ordinary local procedures, except the procedure being called lies on a remote machine.
Implementation involves stubs on either end of the connection.

The local process calls on the stub, much as it would call upon a local procedure.
The RPC system packages up ( marshals ) the parameters to the procedure call, and transmits them to the remote system.
On the remote side, the RPC daemon accepts the parameters and calls upon the appropriate remote procedure to perform the requested work.
Any results to be returned are then packaged up and sent back by the RPC system to the local system, which then unpackages them and returns the results to the local calling procedure.


  • 3.6.3 Pipes

Pipes are one of the earliest and simplest channels of communications between ( UNIX ) processes.
There are four key considerations in implementing pipes:

Unidirectional or Bidirectional communication?
Is bidirectional communication half-duplex or full-duplex?
Must a relationship such as parent-child exist between the processes?
Can pipes communicate over a network, or only on the same machine?


Unidirectional=operating or moving in one direction only; not changing direction
Bidirectional=capable of reacting or functioning in two, usually opposite, directions.
half-duplex=of or pertaining to the transmission of information in opposite directions but not simultaneously.
full-duplex=of or pertaining to the simultaneous, independent transmission of information in both directions over a two-way channel.






  • 3.6.3.1 Ordinary Pipes

Ordinary pipes are uni-directional, with a reading end and a writing end
Ordinary pipes in Windows are very similar. Windows terms them anonymous pipes



  • 3.6.3.2 Named Pipes

Named pipes support bidirectional communication, communication between non-parent-child related processes, and persistence after the process which created them exits.
Multiple processes can also share a named pipe, typically one reader and multiple writers




  • OLD 3.6.3 Remote Method Invocation, RMI ( Removed from 8th edition )


RMI is the Java implementation of RPC for contacting processes operating on a different Java Virtual Machine, JVM, which may or may not be running on a different physical machine.

There are two key differences between RPC and RMI, both based on the object-oriented nature of Java:
RPC accesses remote procedures or functions, in a procedural-programming paradigm. RMI accesses methods within remote Objects.
The data passed by RPC as function parameters are ordinary data only, i.e. ints, floats, doubles, etc. RMI also supports the passing of Objects.


RMI is implemented using stubs ( on the client side ) and skeletons ( on the server's side), whose responsibility is to package ( marshall ) and unpack the parameters and return values being passed back and forth


http://www.cs.uic.edu/~jbell/CourseNotes/OperatingSystems/3_Processes.html


  • Socket


A socket is a transport mechanism. Sockets are like applying procedural networking to object-oriented environment.
Sockets-based network programming can be laborious.

RMI

RMI uses sockets. RMI is object-oriented. Methods can be invoked on the remote objects running on a separate JVM.
RMI provides a convenient abstraction over raw sockets. Can send and receive any valid Java object utilizing underlying object serialization without having to worry about using data streams.

http://www.cloudsopedia.com/interviewquestions/j2ee/j2ee-rmi.php


No comments:

Post a Comment