SlideShare ist ein Scribd-Unternehmen logo
1 von 44
Distributed Systems 1
Chapter 3: Network and Communication
 What is a network?
 What types of network are there?
 What networking standards are there?
 How do you represent information?
 What is communication protocol?
 What are communication models? (message-
passing, stream communication and RPC)
Distributed Systems 2
Anatomy of a network
 A set of interconnected
resources
 Hosts that run network
applications software
− Clients and servers
− Set of peers
 The network infrastructure that
interconnects the hosts
− The networking hardware
and software

Network node devices
such as routers and
switches

Links: cables,
connectors, network
interfaces
Distributed Systems 3
Transmission links
 Convey bits, bytes, packets
 Physical medium
− Copper (or aluminium)
− Optical fibre

Glass, plastic
− Free-space optical

Laser
− Radio

Satellite, microwave link, mobile, wireless LAN,
‘Bluetooth’
 Mode
− Point-to-point
− Shared medium (multicast)
− Broadcast
Distributed Systems 4
Representing data: bits and bytes
 Bits
− Different codes used in different interface standards
− Images, multi-media
− Require special bit pattern as delimiter
 Bytes
− Text is usually ASCII or Unicode characters
− Text files, documents
− Character set includes special control characters
01100001011000111 01110101
Bits Bytes
00000010 10000000 10100001
Distributed Systems 5
Representing data: Frames
 A block of data is called a frame
− Basic unit of transfer between switches
 Main purpose of frame is to carry packets from one point to another on a
network
− Header carries

Addressing (usually rather low level)

Control information for receiving network device (host/network
node)
− Trailer (if present) carries error check

Used for detecting errors in received frame
 Block sizes restricted by buffer sizes in the network device interfaces
header Data or payload trailerFrame:
Distributed Systems 6
Representing data: Packets
 Blocks of application data with some networking routing information
− Basic unit of transfer between routers
 Header carries
− Network-wide addressing information
− Control information for receiving network device (host, router)
 No information is appended to a packet
− There is no trailer, as there is with frames
 In theory, packets can be quite large
header Data or payloadPacket:
Distributed Systems 7
Types of network
 Main types:
− LAN, WAN, MAN, and Internet
 LAN (Local Area Network) is mainly private
− Ether net, Token ring
− Or interconnected
 WAN (Wide Area Network) can be private or public
− Interconnected
 MAN (Metropolitan Area Network) is mainly public
− Interconnected by Optical fibre
 Global Network is public
− The internet
− The telephone network
Distributed Systems 8
Interconnecting LANs and WANs
To offsite
LANs
To the
Internet
 Host systems usually connect into a
LAN switch
– Number of hosts limited by the
number of ports on the switch
 Routers have two main uses
− Interconnecting LANs
− Connecting to a WAN or to the
Internet
 Routers interconnect LANs
− To separate the users
− To separate the traffic
switch
router
Distributed Systems 9
OSI: The International Standards Model
 Created in the 1980s by the standards bodies
− ISO, ITU-T(Telecommunication Standardization Sector) , IEEE
− Contributors included people from all sectors of the industry,
government and academia
 Designed originally to overcome the problems of non-interoperability
between different manufacturers’ computers
 Is a protocol suite
− A set of interdependent layer functions
− A set of interdependent protocols
 Ten years of development rendered it too complex to be of real
practical use, however, we still use
− Most of the Layer names
− Some of the terminology
Distributed Systems 10
OSI: A Seven Layer Protocol
high level application
support tools
conversion between different
machine representations
applications synchronization and
connection management
last chance to correct network
errors before passing to application
network addressing & routing
link control &
data transmission
physical medium control,
bit transmission & timing
networking
protocols
application
protocols
Layer 1 - Physical
Layer 2 - Link:
Layer 3 - Network
Layer 4 - Transport
Layer 5 - Session
Layer 6 - Presentation
Layer 7- Application
Distributed Systems 11
The OSI and IETF Protocol Suites
layers 5/6/7:
Application
TCP, UDP
IP
PPP, 802.3,5,11, etc
Physical
networking
protocols
application
protocols
IETF model OSI model
Layer 1 - Physical
Layer 2 - Link:
Layer 3 - Network
Layer 4 - Transport
Layer 5 - Session
Layer 6 - Presentation
Layer 7- Application
Logical
MAC
IETF: The Internet Engineering Task Force
OSI: Open System Interconnection Reference Model
Distributed Systems 12
Protocol Data Encapsulation
Application data
Transport header and
payload (e.g. TCP segment)
Network header and
payload (e.g. IP packet)
Physical Layer
Network
Layer
Transport
Layer
Application
Layer
Link Layer Link header and payload
(e.g. Ethernet frame)
101011100101
T hdr App data
N hdr Transport
L hdr CRCNetwork
Distributed Systems 13
A Typical Message on the Network
Distributed Systems 14
Protocol Data Flow
Destination IP
Destination port
Transport protocol
Source IP
Source port
Transport protocol
Encapsulation
Physical network
IP
TCP UDP
DNS
client
Web
client
Encapsulation
Physical network
IP
TCP UDP
Web server
Addresses Addresses
Source NIC
Destination NIC
URL
Distributed Systems 15
Communication Models
• Message Passing
lowest level of communication, e.g. sockets
unstructured peer-peer IPC
varieties of communication patterns
• Data Stream
continuous media
satisfy real time data services
• Request / Reply semantics
basis of Client-Server
RPC (Remote Procedure Call)
RMI (Remote Method Invocation)
Distributed Systems 16
Message Passing Definitions(1)
 Procedures:send, receive, accept, create, connect, locate , reply,
acknowledge
 Multiplicity: point-to-point, broadcast, multicast
 Message Content: data or instruction, by value or by reference
(address)
 Channels:
 - link, port, mailbox
 - direction can be uni-diection or bi-direction
 - capacity can be unbounded (i.e. asynchronous, no blocking)
 or null (implies synchronous) or fixed (implies buffering)
 Message Receipt:
 explicit receive – receiver can select message
 implicit receive – receiver must receive from sender
Distributed Systems 17
Message Passing Definitions(2)
 Synchronous/Asynchronous
 Synchronous – receiver waits ready for sender message and responds in
real time (e.g. phone call). Both sender and receiver return when transfer
is complete. No buffer is required.
 Asynchronous – sender sends message into buffer, message picked
up later at receivers convenience (e.g. mailbox). Sender process
returns whether or not a message is received. Receiver blocks until
the message is available
 Blocking/Non-Blocking
 Blocking – sender cannot proceed after sending message until receiver
picks up message
 Non Blocking – sender can continue as soon as message send is done
(e.g. added to buffer)
 Sender/Receiver Naming
 Static – sender and receiver names (location) fixed
 Dynamic – names may change (e.g. ask a static name server
Distributed Systems 18
Message Passing Definitions(3)
 Connection Link
 Connection Oriented – link is established and held for duration of
service. Guaranteed link but bandwidth may be wasted.
 Connectionless – connection not established until message send
occurs e.g. different packets sent by different routes
 Transient
 message is only stored by system while sender and receiver are
executing (e.g. MSN messenger)
 Persistent
 message is stored and delivered by system, even if receiver is not
executing (e.g. email)
Distributed Systems 19
Persistence and Synchronicity in Communication (1)
General organization of a communication system in
which hosts are connected through a network
Distributed Systems 20
Persistence and Synchronicity in Communication (2)
(a) Persistent asynchronous communication
(b) Persistent synchronous communication
Distributed Systems 21
Persistence and Synchronicity in Communication (3)
(c) Transient asynchronous communication
(d) Receipt-based transient synchronous communication
Distributed Systems 22
Persistence and Synchronicity in Communication (4)
(e) Delivery-based transient synchronous communication
at message delivery
(f) Response-based transient synchronous communication
Distributed Systems 23
• A socket is a communication endpoint between processes
• A socket forms the API that allows processes to communicate
point-to-point over the internet, within a LAN or within a single
computer
• Each internet host implements the TCP/IP family of protocols
• A socket is identified by a socket address consisting of an IP
(version 4) address and port number e.g. 129.86.5.20:80
• IP addresses are stored as unsigned 32 bit integer, and frequently
represented in dotted decimal notation.
/* Internet address structure */
struct in_addr {unsigned int s_addr;};
• Port numbers are unsigned 16 bit integers (range 0-65535). Port
numbers 0-1024 are well known and reserved, e.g. 21 ftp, 23 telnet,
25 email, 80 http...
Socket Programming
Distributed Systems 24
Socket Families and Types
• AF_UNIX – for communicating between processes on the same
(UNIX) computer.
• AF_INET – for communicating between processes on different
machines connected by the internet or a LAN.
•SOCK_STREAM is for reliable TCP (Transmission Control Protocol)
connection oriented communication that can be for AF_UNIX or
AF_INET sockets. These streaming sockets allow for continuous
communication.
• SOCK_DGRAM is for unreliable UDP (User Datagram Protocol)
connectionless communication in which process are not required to
connect to the socket continuously. These datagram sockets allow
data to be sent in finite packets (or datagrams). The datagram
protocol applies only to internet AF_INET sockets.
Distributed Systems 25
Socket primitives for TCP/IP
Primitive Meaning
Socket Create a new communication endpoint
Bind Attach a local address to a socket
Listen
Announce willingness to accept
connections
Accept
Block caller until a connection request
arrives
Connect
Actively attempt to establish a
connection
Send Send some data over the connection
Receive Receive some data over the connection
Close Release the connection
Distributed Systems 26
TCP/IP Socket Calls for Connection
socket()
bind()
listen()
accept()
socket()
connect()
recv()
send()
close()
send()
recv()
close()
Server Client
Blocks until
connection
from client
Process request
create socket
bind local IP address of socket to port
place socket in passive mode ready
to accept requests
take next request from queue (or wait) then forks
and create new socket for client connection
Issue connection request to server
Transfer message strings with
send/recv or read/write
Close socket
Distributed Systems 27
UDP/IP Socket Calls for Connection
socket()
bind()
recvfrom()
socket()
sendto()
sendto() recvfrom()
close()
Server Client
blocks until
datagram
received
from a client
Process request
create socket
bind local IP address of socket to port
Receive senders address
and senders datagram
request
Close socket
reply
specify senders address
and send datagram
Distributed Systems 28
#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#define PORT_NUM 2222
char message[20];
main(){ /* process : Romeo.c */
int romeo,fromlen;
struct sockaddr_in romeo_addr, juliet_addr;
romeo = socket(AF_INET, SOCK_DGRAM, 0);
romeo_addr.sin_family = AF_INET;
romeo_addr.sin_addr.s_addr = INADDR_ANY;
romeo_addr.sin_port = 0;
bind(romeo, (struct sockaddr*)&romeo_addr,
sizeof(romeo_addr));
juliet_addr.sin_family = AF_INET;
juliet_addr.sin_addr.s_addr =
inet_addr(“xxx.xxx.xxx.xxx”);
juliet_addr.sin_port = PORT_NUM;
strcpy(message, “Juliet, I love you!”);
sendto(romeo, message, sizeof(message), 0,
(struct sockaddr) &juliet_addr, sizeof(juliet_addr));
fromlen = sizeof(juliet_addr);
recvfrom(romeo, message, sizeof(message), 0,
(struct sockaddr) &juliet_addr, &fromlen);
printf(“Juliet says: %sn”, message);
close(romeo);
}
UDP/IP Socket program example(1)
Distributed Systems 29
UDP/IP Socket program example(2)
#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#define PORT_NUM 2222
char message[20];
main(){ /* process: Juliet.c */
int juliet,fromlen;
struct sockaddr_in romeo_addr, juliet_addr;
juliet = socket(AF_INET, SOCK_DGRAM, 0);
juliet_addr.sin_family = AF_INET;
juliet_addr.sin_addr.s_addr = INADDR_ANY;
juliet_addr.sin_port = PORT_NUM;
bind(juliet, (struct sockaddr*)&juliet_addr,
sizeof(juliet_addr));
fromlen = sizeof(juliet_addr);
recvfrom(juliet, message, sizeof(message), 0,
(struct sockaddr) &romeo_addr, &fromlen);
printf(“Romeo says: %sn”, message);
strcpy(message, “Oh, Romeo! I love you too!”);
sendto(juliet, message, sizeof(message), 0,
(struct sockaddr) &romeo_addr,
sizeof(romeo_addr));
close(juliet);
}
Distributed Systems 30
sender
receiver
Stream Oriented Communication
 Continuous Media: the temporal relationships between different
data item are fundamental to correctly interpreting what the data
actually means (movies, audio streams).
 Discrete Media: the temporal relationships between data items are
not important (text, still images).
Distributed Systems 31
 Asynchronous mode: no timing constraints on data stream.
 Synchronous mode: there is a max end-to-end delay, but how about
too fast?
 Isochronous mode: data items are transferred on time, both max
delay and min delay.
Data Stream transmission modes
Distributed Systems 32
Characteristics of the Input Service Required
 maximum data unit size (bytes)
 Token bucket rate (bytes/sec)
 Toke bucket size (bytes)
 Maximum transmission rate
(bytes/sec)
 Loss sensitivity (bytes)
 Loss interval (µsec)
 Burst loss sensitivity (data units)
 Minimum delay noticed (µsec)
 Maximum delay variation (µsec)
 Quality of guarantee
Specifying QoS
 QoS(Quality of Service): a set of requirements describing what is
needed from the underlying distributed system and network to ensure
the temporal relationships, transmission rates, reliability, etc.
Distributed Systems 33
Token bucket algorithm
 Tokens are generated at a constant rate, and a token represents a fixed
number of bytes, say k.
 Tokens are buffered in a bucket.
 When an application wants to pass N bytes, it will take N/k tokens
from the bucket.
Distributed Systems 34
Request / Reply Model
Principle of RPC between a client and server program.
Distributed Systems 35
Local Procedure Call
main(){
char cip[] = “Buubdl!bu!ebxo”; /* cipher*/
int key = 1;/* secret key */
int len = decrypt(cip, key); /* LPC */
/* other processing */
}
int decrypt(char * s, int key){ /* decryption */
int i = 0;
while( *s) { *s -= key; i++; s++;}
return i;
}
stack stack
cip ->Buubdl!bu!ebxo
len -> ?
key -> 1
stack
cip ->Attack at dawn
len -> 14
key -> 1
Return address
i -> 0
s -> main.cip
key -> 1
cip ->Buubdl!bu!ebxo
len -> ?
key -> 1
afterbefore
LPC
procedure
call
return
Distributed Systems 36
Remote Procedure Call
program stub
(1)
(8)
LPC Bind req
Recv bind
marshal
Send req
Recv
result
unmarsh
return
stub procedure
(5)
(6)
execute
return
recv req
unmarsh
LPC
marshal
send
result
binder
recv req
register
or search
return
client server
Binding server
(8)
(0)
(1)
(7)
(6)
(5)
(4)
(3)
(2)
Distributed Systems 37
Remote Procedure Call: steps
(0) Remote procedures registration;
(1) Client procedure calls client stub in normal way;
(2) Client stub sends a binding request asking for information;
(3) Binding server searches for binding and reply to client stub;
(4) Client stub packs a message (marshalling) and send to server stub;
(5) Server stub unpacks parameters (unmarshalling), invokes LPC;
(6) Server procedure executes and returns results to server stub;
(7) Server stub packs results (marshalling) and sends to client stub;
(8) Client stub unpacks results and returns to client procedure.
Call-by-value: parameter is a straight value (int, float, …)
Call-by-reference: parameter is a pointer to anything (int,
record, array, pointer, …)
Distributed Systems 38
Example: SUN RPC (1)
/* eXtended Data Representation (XDR) definition , file name : caesar.x */
const MAX = 100;
typedef struct { /* return type */
int len;
char code[MAX];
} Data;
typedef struct { /* parameter type */
int key;
char cipher[MAX];
} Args;
program CAESAR { /* CAESAR program */
version VERSION {
Data DECRYPT(Args) = 1; /* decryption procedure */
Data ENCRYPT(Args) = 2; /* encryption procedure*/
} = 5;
} = 8888;
Distributed Systems 39
Example: SUN RPC(2)
Invoke XDR compiler rpcgen to generate the
following files:
 Client stub
 Server main program and server stub
 XDR parameter marshalling/unmarshalling functions
 Program header file, caesar.h, which includes constants,
user defined types, remote procedure prototypes.
Now, we are ready to design other programs.
Distributed Systems 40
/* client program file : client.c */
#include <rpc/rpc.h>
#include “caesar.h”
main(){
CLIENT *cp;
char *serverName = “Caesar_server”;
Args arg;
Data * plaintext;
/* create client pointer */
cp = clnt_create(serverName, CRESAR, VERSION, “udp”);
if (cp == NULL) exit(1);
arg.key = 1; /* set RPC parameters */
arg.cipher = “Buubdl!bu!ebxo”;
plaintext = decrypt_2(&arg, cp); /* issue RPC */
/* other processing */
…
clnt_destroy(cp); /* delete client pointer */
}
/* server program file : server.c */
#include <rpc/rpc.h>
#include “ceasar.h”
Data* decrypt_2(Args *a){ /* decryption */
static Data output; /* must be static */
char s = a->cipher;
int i = 0;
while( *s) { output.code[i] = *s - key; i++; s++;}
output.len = i;
return &output; /* return result */
}
Data* encrypt_2(args *a){ /* encryption */
/* … */
}
Example: SUN RPC(3)
Distributed Systems 41
Example: SUN RPC(4)
Server program
XDR Definition
Client program
Server stub
Header file
client stub
RPC
library
Server code
Client code
The steps in writing a client and a server in SUN RPC
Distributed Systems 42
The steps in writing a client and a server in DCE
RPC
IDL: Interface Definition Language; uuidgen: IDL file generator
DCE: Distributed Computing Environment (Open Software
foundation)
Distributed Systems 43
RPC Semantics
LPC has exact-once semantics, how about RPC?
Server dead? RPC request lost? Reply lost?
 Re-sending RPC (time out)
 Replica filtering
 Re-sending results
Re-sending RPC Replica filtering Re-sending results RPC semantics
no no no maybe
yes no no at-least-once
yes yes no maybe-once
yes yes yes at-most-once
Distributed Systems 44
RMI: Remote Method Invocation

Weitere ähnliche Inhalte

Was ist angesagt?

Fundamentals of Networking
Fundamentals of NetworkingFundamentals of Networking
Fundamentals of Networking
Israel Marcus
 
Computer networks
Computer networksComputer networks
Computer networks
Tej Kiran
 

Was ist angesagt? (20)

Orientation to Computer Networks
Orientation to Computer NetworksOrientation to Computer Networks
Orientation to Computer Networks
 
Protocols
ProtocolsProtocols
Protocols
 
Chapter9
Chapter9Chapter9
Chapter9
 
Network Protocol
Network ProtocolNetwork Protocol
Network Protocol
 
Windows network administration Basic theories
Windows network administration Basic theoriesWindows network administration Basic theories
Windows network administration Basic theories
 
Internet protocol (ip) ppt
Internet protocol (ip) pptInternet protocol (ip) ppt
Internet protocol (ip) ppt
 
Internet protocols
Internet protocolsInternet protocols
Internet protocols
 
EC8551 COMMUNICATION NETWORKS
EC8551 COMMUNICATION NETWORKSEC8551 COMMUNICATION NETWORKS
EC8551 COMMUNICATION NETWORKS
 
Chapter5
Chapter5Chapter5
Chapter5
 
Protocols in computer network
Protocols in computer network   Protocols in computer network
Protocols in computer network
 
Networking basics PPT
Networking basics PPTNetworking basics PPT
Networking basics PPT
 
Basic Networking Network
Basic Networking NetworkBasic Networking Network
Basic Networking Network
 
The Theoretical Network
The Theoretical NetworkThe Theoretical Network
The Theoretical Network
 
Networking Basics
Networking BasicsNetworking Basics
Networking Basics
 
Iap final
Iap finalIap final
Iap final
 
Osi model
Osi modelOsi model
Osi model
 
Network protocals
Network protocalsNetwork protocals
Network protocals
 
Networking Concepts Lesson 06 - Protocols - Eric Vanderburg
Networking Concepts Lesson 06 - Protocols - Eric VanderburgNetworking Concepts Lesson 06 - Protocols - Eric Vanderburg
Networking Concepts Lesson 06 - Protocols - Eric Vanderburg
 
Fundamentals of Networking
Fundamentals of NetworkingFundamentals of Networking
Fundamentals of Networking
 
Computer networks
Computer networksComputer networks
Computer networks
 

Andere mochten auch

Presentation on data communication
Presentation on data communicationPresentation on data communication
Presentation on data communication
Harpreet Dhaliwal
 
Publish versin host monitoring and outbound load balancing(0915113656)
Publish versin host monitoring and outbound load balancing(0915113656)Publish versin host monitoring and outbound load balancing(0915113656)
Publish versin host monitoring and outbound load balancing(0915113656)
gmolina200
 
Data com chapter 1 introduction
Data com chapter 1   introductionData com chapter 1   introduction
Data com chapter 1 introduction
Abdul-Hamid Donde
 
ICTCoreCh11
ICTCoreCh11ICTCoreCh11
ICTCoreCh11
garcons0
 

Andere mochten auch (20)

Data communications Class notes
Data communications  Class notesData communications  Class notes
Data communications Class notes
 
Powerpoint for data communication
Powerpoint for data communication Powerpoint for data communication
Powerpoint for data communication
 
Presentation on data communication
Presentation on data communicationPresentation on data communication
Presentation on data communication
 
Data communication and network Chapter -1
Data communication and network Chapter -1Data communication and network Chapter -1
Data communication and network Chapter -1
 
Chapter 1: Introduction to Data Communication and Networks
Chapter 1: Introduction to Data Communication and NetworksChapter 1: Introduction to Data Communication and Networks
Chapter 1: Introduction to Data Communication and Networks
 
Multicastingand multicast routing protocols
Multicastingand multicast routing protocolsMulticastingand multicast routing protocols
Multicastingand multicast routing protocols
 
1. c or c++ programming course out line
1. c or c++ programming course out line1. c or c++ programming course out line
1. c or c++ programming course out line
 
Operation engine ii session iv operations scheduling
Operation engine  ii session iv  operations schedulingOperation engine  ii session iv  operations scheduling
Operation engine ii session iv operations scheduling
 
Chapter 1 - An Introduction to Programming
Chapter 1 - An Introduction to ProgrammingChapter 1 - An Introduction to Programming
Chapter 1 - An Introduction to Programming
 
Publish versin host monitoring and outbound load balancing(0915113656)
Publish versin host monitoring and outbound load balancing(0915113656)Publish versin host monitoring and outbound load balancing(0915113656)
Publish versin host monitoring and outbound load balancing(0915113656)
 
2 the visible pc
2 the visible pc2 the visible pc
2 the visible pc
 
Data com chapter 1 introduction
Data com chapter 1   introductionData com chapter 1   introduction
Data com chapter 1 introduction
 
Information and Communication Technology Chapter 1,2 ,3 - Dr.J.VijiPriya
Information and Communication Technology Chapter 1,2 ,3 - Dr.J.VijiPriyaInformation and Communication Technology Chapter 1,2 ,3 - Dr.J.VijiPriya
Information and Communication Technology Chapter 1,2 ,3 - Dr.J.VijiPriya
 
ICTCoreCh11
ICTCoreCh11ICTCoreCh11
ICTCoreCh11
 
SC161-Lecture4-1
SC161-Lecture4-1SC161-Lecture4-1
SC161-Lecture4-1
 
Do you know about cat 8 cable
Do you know about cat 8 cableDo you know about cat 8 cable
Do you know about cat 8 cable
 
Security
SecuritySecurity
Security
 
Routing algorithm
Routing algorithmRouting algorithm
Routing algorithm
 
Ch 1
Ch 1Ch 1
Ch 1
 
Dr. J. VijiPriya - Information Communication and Technology Chapter 7 Data Co...
Dr. J. VijiPriya - Information Communication and Technology Chapter 7 Data Co...Dr. J. VijiPriya - Information Communication and Technology Chapter 7 Data Co...
Dr. J. VijiPriya - Information Communication and Technology Chapter 7 Data Co...
 

Ähnlich wie data communication

Class_notes_InternetTechnology
Class_notes_InternetTechnologyClass_notes_InternetTechnology
Class_notes_InternetTechnology
Gulrez Khan
 
Lec 2 and_3
Lec 2 and_3Lec 2 and_3
Lec 2 and_3
hz3012
 
ip net basic understanding slide show ppt
ip net basic understanding slide show pptip net basic understanding slide show ppt
ip net basic understanding slide show ppt
lolo749806
 
Networks (Distributed computing)
Networks (Distributed computing)Networks (Distributed computing)
Networks (Distributed computing)
Sri Prasanna
 
Networking fundamentals
Networking  fundamentalsNetworking  fundamentals
Networking fundamentals
The Avi Sharma
 

Ähnlich wie data communication (20)

Dist 03-4
Dist 03-4Dist 03-4
Dist 03-4
 
Ch 1 network
Ch 1  networkCh 1  network
Ch 1 network
 
Networks Basics
Networks BasicsNetworks Basics
Networks Basics
 
Class_notes_InternetTechnology
Class_notes_InternetTechnologyClass_notes_InternetTechnology
Class_notes_InternetTechnology
 
Lec 2 and_3
Lec 2 and_3Lec 2 and_3
Lec 2 and_3
 
01 pengenalan
01 pengenalan01 pengenalan
01 pengenalan
 
Ccna exploration network fundamentals
Ccna exploration  network fundamentalsCcna exploration  network fundamentals
Ccna exploration network fundamentals
 
CNP proficiency.pptx
CNP proficiency.pptxCNP proficiency.pptx
CNP proficiency.pptx
 
ip-basics.ppt
ip-basics.pptip-basics.ppt
ip-basics.ppt
 
ip net basic understanding slide show ppt
ip net basic understanding slide show pptip net basic understanding slide show ppt
ip net basic understanding slide show ppt
 
Networks (Distributed computing)
Networks (Distributed computing)Networks (Distributed computing)
Networks (Distributed computing)
 
Lecture 1 networking &amp; internetworking
Lecture 1 networking &amp; internetworkingLecture 1 networking &amp; internetworking
Lecture 1 networking &amp; internetworking
 
cns-unit-4-onlinenotepad.io.pdf
cns-unit-4-onlinenotepad.io.pdfcns-unit-4-onlinenotepad.io.pdf
cns-unit-4-onlinenotepad.io.pdf
 
Lecture 12
Lecture 12Lecture 12
Lecture 12
 
Introduction to OSI and QUIC
Introduction to OSI and QUICIntroduction to OSI and QUIC
Introduction to OSI and QUIC
 
Unit 2 ppt-idc
Unit 2 ppt-idcUnit 2 ppt-idc
Unit 2 ppt-idc
 
presentation on Internet and its protocol
presentation on Internet and its protocolpresentation on Internet and its protocol
presentation on Internet and its protocol
 
DCN-chapter1.pdf
DCN-chapter1.pdfDCN-chapter1.pdf
DCN-chapter1.pdf
 
Networking fundamentals
Networking  fundamentalsNetworking  fundamentals
Networking fundamentals
 
MVA slides lesson 2
MVA slides lesson 2MVA slides lesson 2
MVA slides lesson 2
 

Kürzlich hochgeladen

Kürzlich hochgeladen (20)

Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 

data communication

  • 1. Distributed Systems 1 Chapter 3: Network and Communication  What is a network?  What types of network are there?  What networking standards are there?  How do you represent information?  What is communication protocol?  What are communication models? (message- passing, stream communication and RPC)
  • 2. Distributed Systems 2 Anatomy of a network  A set of interconnected resources  Hosts that run network applications software − Clients and servers − Set of peers  The network infrastructure that interconnects the hosts − The networking hardware and software  Network node devices such as routers and switches  Links: cables, connectors, network interfaces
  • 3. Distributed Systems 3 Transmission links  Convey bits, bytes, packets  Physical medium − Copper (or aluminium) − Optical fibre  Glass, plastic − Free-space optical  Laser − Radio  Satellite, microwave link, mobile, wireless LAN, ‘Bluetooth’  Mode − Point-to-point − Shared medium (multicast) − Broadcast
  • 4. Distributed Systems 4 Representing data: bits and bytes  Bits − Different codes used in different interface standards − Images, multi-media − Require special bit pattern as delimiter  Bytes − Text is usually ASCII or Unicode characters − Text files, documents − Character set includes special control characters 01100001011000111 01110101 Bits Bytes 00000010 10000000 10100001
  • 5. Distributed Systems 5 Representing data: Frames  A block of data is called a frame − Basic unit of transfer between switches  Main purpose of frame is to carry packets from one point to another on a network − Header carries  Addressing (usually rather low level)  Control information for receiving network device (host/network node) − Trailer (if present) carries error check  Used for detecting errors in received frame  Block sizes restricted by buffer sizes in the network device interfaces header Data or payload trailerFrame:
  • 6. Distributed Systems 6 Representing data: Packets  Blocks of application data with some networking routing information − Basic unit of transfer between routers  Header carries − Network-wide addressing information − Control information for receiving network device (host, router)  No information is appended to a packet − There is no trailer, as there is with frames  In theory, packets can be quite large header Data or payloadPacket:
  • 7. Distributed Systems 7 Types of network  Main types: − LAN, WAN, MAN, and Internet  LAN (Local Area Network) is mainly private − Ether net, Token ring − Or interconnected  WAN (Wide Area Network) can be private or public − Interconnected  MAN (Metropolitan Area Network) is mainly public − Interconnected by Optical fibre  Global Network is public − The internet − The telephone network
  • 8. Distributed Systems 8 Interconnecting LANs and WANs To offsite LANs To the Internet  Host systems usually connect into a LAN switch – Number of hosts limited by the number of ports on the switch  Routers have two main uses − Interconnecting LANs − Connecting to a WAN or to the Internet  Routers interconnect LANs − To separate the users − To separate the traffic switch router
  • 9. Distributed Systems 9 OSI: The International Standards Model  Created in the 1980s by the standards bodies − ISO, ITU-T(Telecommunication Standardization Sector) , IEEE − Contributors included people from all sectors of the industry, government and academia  Designed originally to overcome the problems of non-interoperability between different manufacturers’ computers  Is a protocol suite − A set of interdependent layer functions − A set of interdependent protocols  Ten years of development rendered it too complex to be of real practical use, however, we still use − Most of the Layer names − Some of the terminology
  • 10. Distributed Systems 10 OSI: A Seven Layer Protocol high level application support tools conversion between different machine representations applications synchronization and connection management last chance to correct network errors before passing to application network addressing & routing link control & data transmission physical medium control, bit transmission & timing networking protocols application protocols Layer 1 - Physical Layer 2 - Link: Layer 3 - Network Layer 4 - Transport Layer 5 - Session Layer 6 - Presentation Layer 7- Application
  • 11. Distributed Systems 11 The OSI and IETF Protocol Suites layers 5/6/7: Application TCP, UDP IP PPP, 802.3,5,11, etc Physical networking protocols application protocols IETF model OSI model Layer 1 - Physical Layer 2 - Link: Layer 3 - Network Layer 4 - Transport Layer 5 - Session Layer 6 - Presentation Layer 7- Application Logical MAC IETF: The Internet Engineering Task Force OSI: Open System Interconnection Reference Model
  • 12. Distributed Systems 12 Protocol Data Encapsulation Application data Transport header and payload (e.g. TCP segment) Network header and payload (e.g. IP packet) Physical Layer Network Layer Transport Layer Application Layer Link Layer Link header and payload (e.g. Ethernet frame) 101011100101 T hdr App data N hdr Transport L hdr CRCNetwork
  • 13. Distributed Systems 13 A Typical Message on the Network
  • 14. Distributed Systems 14 Protocol Data Flow Destination IP Destination port Transport protocol Source IP Source port Transport protocol Encapsulation Physical network IP TCP UDP DNS client Web client Encapsulation Physical network IP TCP UDP Web server Addresses Addresses Source NIC Destination NIC URL
  • 15. Distributed Systems 15 Communication Models • Message Passing lowest level of communication, e.g. sockets unstructured peer-peer IPC varieties of communication patterns • Data Stream continuous media satisfy real time data services • Request / Reply semantics basis of Client-Server RPC (Remote Procedure Call) RMI (Remote Method Invocation)
  • 16. Distributed Systems 16 Message Passing Definitions(1)  Procedures:send, receive, accept, create, connect, locate , reply, acknowledge  Multiplicity: point-to-point, broadcast, multicast  Message Content: data or instruction, by value or by reference (address)  Channels:  - link, port, mailbox  - direction can be uni-diection or bi-direction  - capacity can be unbounded (i.e. asynchronous, no blocking)  or null (implies synchronous) or fixed (implies buffering)  Message Receipt:  explicit receive – receiver can select message  implicit receive – receiver must receive from sender
  • 17. Distributed Systems 17 Message Passing Definitions(2)  Synchronous/Asynchronous  Synchronous – receiver waits ready for sender message and responds in real time (e.g. phone call). Both sender and receiver return when transfer is complete. No buffer is required.  Asynchronous – sender sends message into buffer, message picked up later at receivers convenience (e.g. mailbox). Sender process returns whether or not a message is received. Receiver blocks until the message is available  Blocking/Non-Blocking  Blocking – sender cannot proceed after sending message until receiver picks up message  Non Blocking – sender can continue as soon as message send is done (e.g. added to buffer)  Sender/Receiver Naming  Static – sender and receiver names (location) fixed  Dynamic – names may change (e.g. ask a static name server
  • 18. Distributed Systems 18 Message Passing Definitions(3)  Connection Link  Connection Oriented – link is established and held for duration of service. Guaranteed link but bandwidth may be wasted.  Connectionless – connection not established until message send occurs e.g. different packets sent by different routes  Transient  message is only stored by system while sender and receiver are executing (e.g. MSN messenger)  Persistent  message is stored and delivered by system, even if receiver is not executing (e.g. email)
  • 19. Distributed Systems 19 Persistence and Synchronicity in Communication (1) General organization of a communication system in which hosts are connected through a network
  • 20. Distributed Systems 20 Persistence and Synchronicity in Communication (2) (a) Persistent asynchronous communication (b) Persistent synchronous communication
  • 21. Distributed Systems 21 Persistence and Synchronicity in Communication (3) (c) Transient asynchronous communication (d) Receipt-based transient synchronous communication
  • 22. Distributed Systems 22 Persistence and Synchronicity in Communication (4) (e) Delivery-based transient synchronous communication at message delivery (f) Response-based transient synchronous communication
  • 23. Distributed Systems 23 • A socket is a communication endpoint between processes • A socket forms the API that allows processes to communicate point-to-point over the internet, within a LAN or within a single computer • Each internet host implements the TCP/IP family of protocols • A socket is identified by a socket address consisting of an IP (version 4) address and port number e.g. 129.86.5.20:80 • IP addresses are stored as unsigned 32 bit integer, and frequently represented in dotted decimal notation. /* Internet address structure */ struct in_addr {unsigned int s_addr;}; • Port numbers are unsigned 16 bit integers (range 0-65535). Port numbers 0-1024 are well known and reserved, e.g. 21 ftp, 23 telnet, 25 email, 80 http... Socket Programming
  • 24. Distributed Systems 24 Socket Families and Types • AF_UNIX – for communicating between processes on the same (UNIX) computer. • AF_INET – for communicating between processes on different machines connected by the internet or a LAN. •SOCK_STREAM is for reliable TCP (Transmission Control Protocol) connection oriented communication that can be for AF_UNIX or AF_INET sockets. These streaming sockets allow for continuous communication. • SOCK_DGRAM is for unreliable UDP (User Datagram Protocol) connectionless communication in which process are not required to connect to the socket continuously. These datagram sockets allow data to be sent in finite packets (or datagrams). The datagram protocol applies only to internet AF_INET sockets.
  • 25. Distributed Systems 25 Socket primitives for TCP/IP Primitive Meaning Socket Create a new communication endpoint Bind Attach a local address to a socket Listen Announce willingness to accept connections Accept Block caller until a connection request arrives Connect Actively attempt to establish a connection Send Send some data over the connection Receive Receive some data over the connection Close Release the connection
  • 26. Distributed Systems 26 TCP/IP Socket Calls for Connection socket() bind() listen() accept() socket() connect() recv() send() close() send() recv() close() Server Client Blocks until connection from client Process request create socket bind local IP address of socket to port place socket in passive mode ready to accept requests take next request from queue (or wait) then forks and create new socket for client connection Issue connection request to server Transfer message strings with send/recv or read/write Close socket
  • 27. Distributed Systems 27 UDP/IP Socket Calls for Connection socket() bind() recvfrom() socket() sendto() sendto() recvfrom() close() Server Client blocks until datagram received from a client Process request create socket bind local IP address of socket to port Receive senders address and senders datagram request Close socket reply specify senders address and send datagram
  • 28. Distributed Systems 28 #include <stdio.h> #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #define PORT_NUM 2222 char message[20]; main(){ /* process : Romeo.c */ int romeo,fromlen; struct sockaddr_in romeo_addr, juliet_addr; romeo = socket(AF_INET, SOCK_DGRAM, 0); romeo_addr.sin_family = AF_INET; romeo_addr.sin_addr.s_addr = INADDR_ANY; romeo_addr.sin_port = 0; bind(romeo, (struct sockaddr*)&romeo_addr, sizeof(romeo_addr)); juliet_addr.sin_family = AF_INET; juliet_addr.sin_addr.s_addr = inet_addr(“xxx.xxx.xxx.xxx”); juliet_addr.sin_port = PORT_NUM; strcpy(message, “Juliet, I love you!”); sendto(romeo, message, sizeof(message), 0, (struct sockaddr) &juliet_addr, sizeof(juliet_addr)); fromlen = sizeof(juliet_addr); recvfrom(romeo, message, sizeof(message), 0, (struct sockaddr) &juliet_addr, &fromlen); printf(“Juliet says: %sn”, message); close(romeo); } UDP/IP Socket program example(1)
  • 29. Distributed Systems 29 UDP/IP Socket program example(2) #include <stdio.h> #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #define PORT_NUM 2222 char message[20]; main(){ /* process: Juliet.c */ int juliet,fromlen; struct sockaddr_in romeo_addr, juliet_addr; juliet = socket(AF_INET, SOCK_DGRAM, 0); juliet_addr.sin_family = AF_INET; juliet_addr.sin_addr.s_addr = INADDR_ANY; juliet_addr.sin_port = PORT_NUM; bind(juliet, (struct sockaddr*)&juliet_addr, sizeof(juliet_addr)); fromlen = sizeof(juliet_addr); recvfrom(juliet, message, sizeof(message), 0, (struct sockaddr) &romeo_addr, &fromlen); printf(“Romeo says: %sn”, message); strcpy(message, “Oh, Romeo! I love you too!”); sendto(juliet, message, sizeof(message), 0, (struct sockaddr) &romeo_addr, sizeof(romeo_addr)); close(juliet); }
  • 30. Distributed Systems 30 sender receiver Stream Oriented Communication  Continuous Media: the temporal relationships between different data item are fundamental to correctly interpreting what the data actually means (movies, audio streams).  Discrete Media: the temporal relationships between data items are not important (text, still images).
  • 31. Distributed Systems 31  Asynchronous mode: no timing constraints on data stream.  Synchronous mode: there is a max end-to-end delay, but how about too fast?  Isochronous mode: data items are transferred on time, both max delay and min delay. Data Stream transmission modes
  • 32. Distributed Systems 32 Characteristics of the Input Service Required  maximum data unit size (bytes)  Token bucket rate (bytes/sec)  Toke bucket size (bytes)  Maximum transmission rate (bytes/sec)  Loss sensitivity (bytes)  Loss interval (µsec)  Burst loss sensitivity (data units)  Minimum delay noticed (µsec)  Maximum delay variation (µsec)  Quality of guarantee Specifying QoS  QoS(Quality of Service): a set of requirements describing what is needed from the underlying distributed system and network to ensure the temporal relationships, transmission rates, reliability, etc.
  • 33. Distributed Systems 33 Token bucket algorithm  Tokens are generated at a constant rate, and a token represents a fixed number of bytes, say k.  Tokens are buffered in a bucket.  When an application wants to pass N bytes, it will take N/k tokens from the bucket.
  • 34. Distributed Systems 34 Request / Reply Model Principle of RPC between a client and server program.
  • 35. Distributed Systems 35 Local Procedure Call main(){ char cip[] = “Buubdl!bu!ebxo”; /* cipher*/ int key = 1;/* secret key */ int len = decrypt(cip, key); /* LPC */ /* other processing */ } int decrypt(char * s, int key){ /* decryption */ int i = 0; while( *s) { *s -= key; i++; s++;} return i; } stack stack cip ->Buubdl!bu!ebxo len -> ? key -> 1 stack cip ->Attack at dawn len -> 14 key -> 1 Return address i -> 0 s -> main.cip key -> 1 cip ->Buubdl!bu!ebxo len -> ? key -> 1 afterbefore LPC procedure call return
  • 36. Distributed Systems 36 Remote Procedure Call program stub (1) (8) LPC Bind req Recv bind marshal Send req Recv result unmarsh return stub procedure (5) (6) execute return recv req unmarsh LPC marshal send result binder recv req register or search return client server Binding server (8) (0) (1) (7) (6) (5) (4) (3) (2)
  • 37. Distributed Systems 37 Remote Procedure Call: steps (0) Remote procedures registration; (1) Client procedure calls client stub in normal way; (2) Client stub sends a binding request asking for information; (3) Binding server searches for binding and reply to client stub; (4) Client stub packs a message (marshalling) and send to server stub; (5) Server stub unpacks parameters (unmarshalling), invokes LPC; (6) Server procedure executes and returns results to server stub; (7) Server stub packs results (marshalling) and sends to client stub; (8) Client stub unpacks results and returns to client procedure. Call-by-value: parameter is a straight value (int, float, …) Call-by-reference: parameter is a pointer to anything (int, record, array, pointer, …)
  • 38. Distributed Systems 38 Example: SUN RPC (1) /* eXtended Data Representation (XDR) definition , file name : caesar.x */ const MAX = 100; typedef struct { /* return type */ int len; char code[MAX]; } Data; typedef struct { /* parameter type */ int key; char cipher[MAX]; } Args; program CAESAR { /* CAESAR program */ version VERSION { Data DECRYPT(Args) = 1; /* decryption procedure */ Data ENCRYPT(Args) = 2; /* encryption procedure*/ } = 5; } = 8888;
  • 39. Distributed Systems 39 Example: SUN RPC(2) Invoke XDR compiler rpcgen to generate the following files:  Client stub  Server main program and server stub  XDR parameter marshalling/unmarshalling functions  Program header file, caesar.h, which includes constants, user defined types, remote procedure prototypes. Now, we are ready to design other programs.
  • 40. Distributed Systems 40 /* client program file : client.c */ #include <rpc/rpc.h> #include “caesar.h” main(){ CLIENT *cp; char *serverName = “Caesar_server”; Args arg; Data * plaintext; /* create client pointer */ cp = clnt_create(serverName, CRESAR, VERSION, “udp”); if (cp == NULL) exit(1); arg.key = 1; /* set RPC parameters */ arg.cipher = “Buubdl!bu!ebxo”; plaintext = decrypt_2(&arg, cp); /* issue RPC */ /* other processing */ … clnt_destroy(cp); /* delete client pointer */ } /* server program file : server.c */ #include <rpc/rpc.h> #include “ceasar.h” Data* decrypt_2(Args *a){ /* decryption */ static Data output; /* must be static */ char s = a->cipher; int i = 0; while( *s) { output.code[i] = *s - key; i++; s++;} output.len = i; return &output; /* return result */ } Data* encrypt_2(args *a){ /* encryption */ /* … */ } Example: SUN RPC(3)
  • 41. Distributed Systems 41 Example: SUN RPC(4) Server program XDR Definition Client program Server stub Header file client stub RPC library Server code Client code The steps in writing a client and a server in SUN RPC
  • 42. Distributed Systems 42 The steps in writing a client and a server in DCE RPC IDL: Interface Definition Language; uuidgen: IDL file generator DCE: Distributed Computing Environment (Open Software foundation)
  • 43. Distributed Systems 43 RPC Semantics LPC has exact-once semantics, how about RPC? Server dead? RPC request lost? Reply lost?  Re-sending RPC (time out)  Replica filtering  Re-sending results Re-sending RPC Replica filtering Re-sending results RPC semantics no no no maybe yes no no at-least-once yes yes no maybe-once yes yes yes at-most-once
  • 44. Distributed Systems 44 RMI: Remote Method Invocation