Inter-Process Communication Models: Chapter 4 and Other Emerging Technologies
Inter-Process Communication Models: Chapter 4 and Other Emerging Technologies
Models
Chapter 4 and other emerging
technologies
12/7/18 1
Topics for discussion
Interprocess communication in
distributed system
High level language API/libraries for IPC
and networking
Application layer: HTML, XML, SOAP
and REST
12/7/18 2
Interprocess communication
(IPC)
Is about characteristics of protocols for communication
between processes in a distributed systems.
IP provides datagram and stream processing (What is
the difference?)
APIs are available for IPC: Ch.4 discusses a Java API;
these provide support for programming high level
communication services (Ch.4 and Ch.5)
We limit the discussion to point-to-point but it can be
easily extended to other models.
API to TCP provides the abstract of a two-way stream
between pairs of processes for streams of data.
12/7/18 3
HLL APIs/libraries for TCP
Java networking:
https://docs.oracle.com/javase/8/docs/technotes/
guides/net/index.html
Python API:
https://docs.python.org/3/howto/sockets.html
12/7/18 4
Application Layers
12/7/18 5
IPC Characteristics
Message passing between processes is
supported by “send” and “receive”
Synchronous or asynchronous
communication
Message destination specification:
addressing
Reliability
Ordering
12/7/18 6
Sockets and ports
message
client server
other ports
Internet address = 138.37.94.248 Internet address = 138.37.88.249
Instructor’s Guide for Coulouris, Dollimore, Kindberg and Blair, Distributed Systems: Concepts and Design Edn. 5
© Pearson Education 2012
Java API
InetAddress =
InetAddress.getByName(“timberlake.cse.buffalo.edu”);
128.205.32.8
Will return 4 bytes for IPV4 and 16 bytes
for IPV6
UDP packet:
Array of bytes, length of message, Internet address, Port Number
12/7/18 8
UDP client sends a message to the server
and gets a reply
import java.net.*;
import java.io.*;
public class UDPClient{
public static void main(String args[]){
// args give message contents and server hostname
DatagramSocket aSocket = null;
try {
aSocket = new DatagramSocket();
byte [] m = args[0].getBytes();
InetAddress aHost = InetAddress.getByName(args[1]);
int serverPort = 6789;
DatagramPacket request = new DatagramPacket(m, m.length(), aHost, serverPort);
aSocket.send(request);
byte[] buffer = new byte[1000];
DatagramPacket reply = new DatagramPacket(buffer, buffer.length);
aSocket.receive(reply);
System.out.println("Reply: " + new String(reply.getData()));
}catch (SocketException e){System.out.println("Socket: " + e.getMessage());
}catch (IOException e){System.out.println("IO: " + e.getMessage());}
}finally {if(aSocket != null) aSocket.close();}
}
Instructor’s Guide for Coulouris, Dollimore, Kindberg and Blair, Distributed Systems: Concepts and Design Edn. 5
} © Pearson Education 2012
UDP server repeatedly receives a request
and sends it back to the client
import java.net.*;
import java.io.*;
public class UDPServer{
public static void main(String args[]){
DatagramSocket aSocket = null;
try{
aSocket = new DatagramSocket(6789);
byte[] buffer = new byte[1000];
while(true){
DatagramPacket request = new DatagramPacket(buffer, buffer.length);
aSocket.receive(request);
DatagramPacket reply = new DatagramPacket(request.getData(),
request.getLength(), request.getAddress(), request.getPort());
aSocket.send(reply);
}
}catch (SocketException e){System.out.println("Socket: " + e.getMessage());
}catch (IOException e) {System.out.println("IO: " + e.getMessage());}
}finally {if(aSocket != null) aSocket.close();}
}
}
Instructor’s Guide for Coulouris, Dollimore, Kindberg and Blair, Distributed Systems: Concepts and Design Edn. 5
© Pearson Education 2012
Lets examine upper level
protocols
HTTP : Hyper Text Transfer Protocol
HTML: Hyper Text Markup Language
XML: eXtensible Markup Language
Resource references on the web
Web services
SOAP: Simple Object Request Protocol
REST: Representational State Transfer
12/7/18 11
HTTP
Protocol for communication among web entities.
It is a standard from IETF (Internet Engineering Task
Force) and W3C: (World Wide Web Consortium)
Request-response model for client-server systems
HTTP operates by sending requests with operations
to be performed on resources referred by Uniform
Resource Identifiers (URI)
Request methods are: HEAD, GET, POST, PUT,
DELETE, TRACE,… PATCH (just a few standard
commands)
12/7/18 12
HTML
Hyper text mark-up language
Standard markups for structural
organization of web pages
Example:
<tr> <td style="vertical-align: top;"><br> </td>
<td style="vertical-align: top;">File System<br>
</td> <td style="vertical-align: top;"><a href=“
ThisPres.pptx">FileSys</a><br> </td> <td
style="vertical-align: top;"><br> </td> </tr>
12/7/18 13
HTML over HTTP
Web Browser
Web Browser
12/7/18 14
XML
XML is a markup language, developed by
W3C (World Wide Web Consortium), mainly
to overcome the limitations of HTML.
But it took a life of its own and has become a
very popular part of distributed systems.
We will examine its definition, associated
specifications (DTD, XSLT etc.), Java APIs
available to process XML, protocols and
services based on XML, and the role XML
plays in a distributed computing environment.
12/7/18 15
First Look at XML
It has no predefined tags.
Such as in HTML
Domains may specify their own set of standard
tags
It is stricter.
Most html document have errors and the browser
have to built to take care of these.
On the other hand XML has a strict syntax.
There is a notion of validity and
A notion of well-formed.
12/7/18 16
An Example: Memo
See the two documents enclosed: one
in html and the other in XML formats.
Observe the meaningful tags in XML.
Compare it to a class definition: it looks
like a class with data definitions and
accessors (tags).
12/7/18 17
Memo.html vs memo.xml
<?xml version="1.0"
<!DOCTYPE html PUBLIC
?> "-//W3C//DTD HTML 4.01 Transitional//EN">
<!DOCTYPE memo (View Source for full doctype...) >
<html>
-<head>
<memo>
<meta http-equiv="content-type"
<header>Hello World</header>
content="text/html;
<from>bina</from> charset=ISO-8859-1">
<title>memo.html</title>
<to>CSE486 DS Students</to>
</head>
<body>Wake up everyone</body>
<body>
<sign>br</sign>
<h3>Hello
</memo>World</h3>
Bina<br>
CSE486 DS Students <br>
Wake up everyone<br>
BR<br>
<br>
</body>
</html>
12/7/18 18
XML
12/7/18 19
XML to SOAP
Simple xml can facilitate sending
message to receive information.
The message could be operations to be
performed on objects.
Simple Object Access Protocol (SOAP)
Representational State Transfer (REST)
is an architectural pattern on HTTP’s
methods
12/7/18 20
SOAP Request
<soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<getProductDetails xmlns="http://warehouse.example.com/ws">
<productId>827635</productId>
</getProductDetails>
</soap:Body>
</soap:Envelope>
12/7/18 21
SOAP Reply
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<getProductDetailsResponse xmlns="http://warehouse.example.com/ws">
<getProductDetailsResult>
<productName>Toptimate 3-Piece Set</productName>
<productId>827635</productId>
<description>3-Piece luggage set. Black Polyester.</description>
<price>96.50</price>
<inStock>true</inStock>
</getProductDetailsResult>
</getProductDetailsResponse>
</soap:Body>
</soap:Envelope>
12/7/18 22
SOAPWeb Services (WS)SOA
Read this paper by Tim Berners Lee on WS:
http://www.w3.org/DesignIssues/WebService
s.html
Service-oriented Architecture (SOA)
Precursor to micro services
But a monolithic collection of related
functions/services
12/7/18 23
WS Stack
WSFL Service Flow
Quality of Service
Management
Security
UDDI Service Publication
HTTP, FTP, MQ
Network
Email,12/7/18
IIOP 24
WS Interoperability Infrastructure
HTTP Network
12/7/18 26