DISTRIBUTED SYSTEMS Principles and Paradigms

  DISTRIBUTED SYSTEMS Principles and Paradigms Second Edition ANDREW S. TANENBAUM

  Plan

  • Communication protocols
    • – Lower-level and higher-level
    • – Communication types

  • Communication services
    • – Remote Procedure Call – Message-oriented communication
    • – Stream-oriented communication
    • – Multicasting

  • Concrete instances
    • – Java sockets
    • – Java Remote Method Invocation (RMI)
    • – Java Message Service (JMS)

  Plan

  • Wireshark • Java technology
    • – Remote Procedure Call

  • Java RMI
    • – Message-Oriented Communication

  • Transient: Java sockets
  • Persistent: Mickey Mouse JMS
    • – Streaming

  • Will not look at time-critical streaming
    • – Multicast

  • Will look at JGroups later

  Wireshark

  • • Great open-source tool for understanding and

  debugging protocol behavior

  • – http://www.wireshark.org
    • Features:

  • – Trace packets over the wire
  • – Sophisticated filtering language
  • – Display contents of each protocol
  • – Dump contents into file
  • – Display TCP conversation
    • (Formerly known as “Ethereal”)

Wireshark

  Captures frames/packets on this level Protocol decoders for these levels A Google Client

  Capturing

Supports over 750 protocols…

  ISO 8650- 1 OSI Associat ion Control Ser vice

  IPX Mess age

  IPX Routing Infor mation Protocol

  IPX WAN

  IRemUnknown

  IRemUnknown2

  ISDN

  ISDN Q.921-User Adapt ation Layer

  ISDN User Part

  ISO 10589 ISIS InTRA D omain Routeing Infor mation Exchange Prot ocol

  ISO 8073 COTP Connec tion-Or iented Transport Prot ocol

  ISO 8327- 1 OSI Session Protoc ol

  ISO 8473 CLNP Connect ionLes s Net wor k Protocol

  ISO 8571 FTAM

  ISO 8602 CLTP Connect ionLes s Trans port Pr otocol

  ISO 8823 OSI Presentati on Prot ocol

  IP Payload Compression

  IT U-T Recommendation H.263 RTP Payload header (RFC2190) InMon sFl ow Infor mation Access Prot ocol Init shutdown ser vice Intel ANS probe Intelligent Net wor k Appli cation Protocol Intelligent Platfor m Management Interface Inter-Access-Poi nt Protocol Inter-Aster is k eXchange v2 InterSwitc h Mess age Protocol Interbase Internet C ache Pr otocol Internet C ommunications Engine Protocol Internet C ontent Adaptati on Prot ocol Internet C ontrol Message Protocol Internet C ontrol Message Protocol v6 Internet Gr oup M anagement Protocol Internet Gr oup members hip Aut henticat ion Protocol Internet M essage Acces s Protocol Internet Pr inting Protocol Internet Pr otocol Internet Pr otocol Version 6 Internet R elay Chat Internet Securit y Association and Key Management Protocol Internet wor k Datagram Protocol Internet wor k Pac ket eXc hange IrC OMM Protocol IrD A Link Access Protoc ol IrD A Link Management Protocol IuU P JPEG File Interchange For mat JXTA Connection Welcome Message JXTA Mes sage JXTA Mes sage Framing JXTA P2P JXTA UD P Jabber XML Mes saging Java RMI Java Serialization Juniper K12xx Ker berized Internet Negotiation of Key Ker beros Ker beros Admini stration Ker beros v4 Ker nel Loc k Manager LWAP Control M essage LWAPP Encapsul ated Pac ket LWAPP Layer 3 Pac ket Label Dist ribution Protoc ol Laplink Layer 2 Tunneling Protoc ol Light Weight DN S RESol ver (BI ND9) Light weight Direc tor y Ac cess Protocol Light weight User Datagram Protocol Line Printer Daemon Protocol Line-based text data Link Access Proc edure Balanced (LAPB) Link Access Proc edure Balanced Ether net (LAPBET HER) Link Access Proc edure, Channel D (LAPD) Link Layer Discover y Pr otocol Link Management Protoc ol (LM P) Linux cooked- mode capt ure Loc al Management Interf ace Loc alTal k Link Ac cess Protocol Log Mess age Logical Link Cont rol GPRS Logical-Li nk Cont rol Logical-Li nk Cont rol Bas ic For mat XID Logot ype Certific ate Extensions Luc ent/As cend debug output MAC Cont rol MAP_Dial oguePDU M DS Header MEGACO MI ME Mul tipart Media Encapsulation M MS M MS Mes sage Encapsulation MS Kpass wd MS Net wor k Load Balancing MS Proxy Protoc ol MSN Mes senger Ser vic e MSNIP: M ulticast Sourc e Notifi cation of Interest Prot ocol MT P 2 Tr ansparent Proxy MT P 2 Us er Adaptation Layer MT P 3 Us er Adaptation Layer MT P2 Peer Adapt ation Layer M ULTIMEDIA-SYSTEM -CON TROL Media Gat eway Control Protocol Media T ype Media T ype: mes sage/

  X.29 X.411 Mes sage Transfer Ser vic e X.420 File Transf er Body Part X.420 Infor mation Object X.501 Director y Operational Binding Management Pr otocol X.509 Authenticati on Framewor k X.509 Cert ificate Extensi ons X.509 Infor mation Framewor k X.509 Selected At tribute T ypes X.519 Director y Access Protocol X.519 Director y I nfor mat ion Shadowing Protoc ol X.519 Director y System Protoc ol X.880 OSI Remot e Oper ations Ser vice X11 X711 CMI P Xyplex Yahoo Messenger Protocol Yahoo YM SG Messenger Protocol Yel low Pages Bind Yel low Pages Pass wd Yel low Pages Ser vice Yel low Pages Transfer Zebra Prot ocol Zone Infor mation Protoc ol eD onkey Protocol eXt ensible Mar kup Language giFT Inter net File Transf er h450 iF CP iSCSI iSNS iTunes podCast r ss elements rss

  X.25 X.25 over TCP

  X Display Manager Cont rol Prot ocol X.228 OSI Reliabl e Transfer Ser vice

  Pragmatic Gener al Multi cast Precision Ti me Protocol (IEEE1588) Pri nter Ac cess Pr otocol Pri s m Pri vilege Ser ver operations Protocol Independent Multicast Q.2931 Q.931 Q.933 Quake II N et wor k Protoc ol Quake III Arena N et wor k Protoc ol Quake Net wor k Protocol QuakeWorld Net wor k Pr otocol Qualified Logical Link Control RD M RF C 2250 MPEG 1 RF C 2833 RTP Event RI Png RPC Browser RS Interface properties RSTAT RSYNC F ile Synchronis er RT cfg RX Protoc ol Radio Acc ess Net wor k Applicat ion Par t Radius Pr otocol Raw pac ket data Real Data Transport Real Ti me Streaming Protocol Real-Ti me Media Acces s Contr ol Real-Ti me Publis h-Subs cribe Wire Pr otocol Real-Ti me Trans port Pr otocol Real-ti me Transport Control Pr otocol Redbac k Redundant Link Management Pr otocol Registr y Ser ver Attributes Mani pulation Interface Registr y s er ver administ ration operations. Rel iable U DP Remote M anagement C ontrol Protocol Remote O verride interface Remote Procedur e Call Remote Program Load Remote Q uota Remote R egistry Ser vic e Remote Shell Remote Wall prot ocol Remote s ec_login preaut h interf ace. Resource Reser Vation Protocol (RSVP) Ret i x Spanning Tree Protocol Rlogin Protocol Routing Infor mati on Prot ocol Routing Table Maintenance Prot ocol SADMIN D SC SI SEBEK - Kernel Data Capture SG I Mount Ser vic e SM B (Ser ver Message Bloc k Protocol) SM B Mail Slot Pr otocol SM B Pipe Protoc ol SM B2 (Ser ver M essage Bloc k Protocol version 2) SN A-over -Ethernet SN MP Multiplex Protocol SPNEGO- KRB5 SPRAY SS7 SCC P-User Adaptation Layer SSCF-NN I SSCOP SSH Protocol ST ANAG 4406 M ilitar y Message ST ANAG 5066 (SIS layer) Secure Soc ket Layer Sequenced Pac ket Protocol Sequenced Pac ket eXchange Ser ial Infr ared Ser vice Advertisement Protocol Ser vice Location Protocol Session Announc ement Protocol Session D escripti on Prot ocol Session Initiation Protoc ol Session Initiation Protoc ol (SIP as raw text) Short Mes sage Peer to Peer Short Mes sage Relaying Ser vic e Signaling Compr ession Signalling Connection C ontrol Part Signalling Connection C ontrol Part Management Si mple M ail Transfer Pr otocol Si mple Net wor k Management Protocol Si mple Pr otected Negotiation Si mple Tr aversal of UD P Through NAT Sinec H1 Protocol Sipfrag Ski nny Cli ent Control Pr otocol Sli MP3 C ommunication Protoc ol Slow Prot ocols Soc ks Protocol SoulSeek Protocol Spanning Tree Pr otocol Str eam C ontrol T rans mi ssion Protocol Subnet wor k Dependent Convergence Protocol Symantec Enterprise Fir ewall Synchroni zed Multi medi a Integration Language Synchronous Dat a Link Control (SDLC ) Synergy Syslog message Systems Net wor k Archit ecture Systems Net wor k Archit ecture XID T.38 TACACS TACACS+ TD MA RT mac D iscipline TEI Management Procedure, C hannel D (LAPD) TPKT - ISO on T CP - R FC1006 Tabular D ata Stream Tango Dissector Using GIOP API Taz men Sniffer Protocol Tel net Ter edo IPv6 over UDP t unneling The Ar magetron Advanc ed OpenGL Tr on clone Ti me Prot ocol Ti me Synchroniz ation Pr otocol Tiny Transport Pr otocol Token-Ring Token-Ring Medi a Access Cont rol Transaction Capabilities Applic ation Part Trans mis sion Control Pr otocol Transparent Inter Proces s Communication(TI PC) Transparent Net wor k Substrate Protoc ol Transport Adapter Layer Interface v1.0, RFC 3094 Tri vial Fil e Trans fer Prot ocol UD P Encapsulati on of IPsec Pac kets UT RAN Iub interf ace NBAP signalling UT RAN Iur interf ace Radio Net wor k Subs ystem Appl ication Part Uni versal Computer Protocol Unl icensed Mobil e Access Us er Datagram Protocol V5. 2-User Adaptation Layer Virt ual Net wor k Computi ng Virt ual Router Redundanc y Prot ocol Virt ual Trunking Protocol WAP Binar y XML WAP Ses sion Init iation Request WI NS ( Wi ndows Internet Name Ser vic e) Replication Web Cache Coor dination Protocol WebSpher e MQ WebSpher e MQ Programmable Command F or mats Wellfleet Breath of Life Wellfleet Compression Wellfleet HDLC Who Wi ndows 2000 D NS Wi reless Session Protoc ol Wi reless Transaction Pr otocol Wi reless Transport Layer Securit y Wl an Cert ificate Extensi on

  Message Session Relay Protoc ol Message Transfer Part Level 2 Message Transfer Part Level 3 Message Transfer Part Level 3 Management Meta Anal ysis Tr acing Engine Mi crosoft AT-Scheduler Ser vic e Mi crosoft Distributed Fil e System Mi crosoft Distributed Link Trac king Ser ver Ser vice Mi crosoft Encr ypt ed File System Ser vi ce Mi crosoft Eventlog Ser vi ce Mi crosoft Exchange MAPI Mi crosoft File Replication Ser vi ce Mi crosoft File Replication Ser vi ce API Mi crosoft Local Securit y Architecture Mi crosoft Media Ser ver Mi crosoft Messenger Ser vice Mi crosoft Net wor k Logon Mi crosoft Plug and Play ser vice Mi crosoft Routing and R emote Access Ser vic e Mi crosoft Securit y Account Manager Mi crosoft Ser ver Ser vic e Mi crosoft Ser vice Contr ol Mi crosoft Spool Subs yst em Mi crosoft Telephony API Ser vic e Mi crosoft Windows Browser Pr otocol Mi crosoft Windows Lanman Remote API Prot ocol Mi crosoft Windows Logon Protocol (Ol d) Mi crosoft Wor kst ation Ser vice Mobile IP Mobile IPv6 / Net wor k M obilit y Modbus/T CP Monotone Nets ync Mount Ser vice MultiProtocol Label Swit ching Header Multicast Router DISCover y pr otocol Multicast Source Discover y Protocol Multiprotocol Label Swit ching Echo M ySQL Pr otocol NBMA Next Hop Resolution Pr otocol NF SACL NF SAUT H NI S+ NI S+ Call bac k NSPI NT LM Secure Ser vice Provider Name Binding Protocol Name Management Prot ocol over IPX Negati ve- ac knowledgment Oriented R eliable Multicast Net BIOS Net BIOS Datagram Ser vice Net BIOS Name Ser vice Net BIOS Session Ser vic e Net BIOS over IPX Net Scape Certific ate Ext ensions Net Ware Core Pr otocol Net Ware Link Ser vices Protocol Net Ware Serializ ation Protocol Net wor k Data Management Protocol Net wor k F ile Sys tem Net wor k Loc k Manager Protocol Net wor k News T ransfer Protoc ol Net wor k Ser vice O ver I P Net wor k Status Monitor CallBac k Prot ocol Net wor k Status Monitor Protocol Net wor k T i me Pr otocol Nortel SO NMP Novell Cluster Ser vices Novell Dis tributed Print System Novell Modular Authenti cation Ser vice Novell SecretStor e Ser vi ces Nul l/Loopbac k Onl ine Certificate Status Protoc ol Open Poli c y Ser vice Interface Open Shor test Path First OpenBSD Encapsulating device OpenBSD Pac ket Filter l og file OpenBSD Pac ket Filter l og file, pre 3.4 Opt i mized Link St ate Routing Protocol PC NFS PKCS#1 PKI NIT PKI X CER T File For mat PKI X Qual ified PKI X Ti me Stamp Protocol PKI X1Expl itit PKI X1I mpl itit PKI XProxy (RFC 3820) PPP Bandwidth Allocation Contr ol Prot ocol PPP Bandwidth Allocation Protocol PPP CDP Control Protocol PPP Callbac k Control Pr otocol PPP Chall enge Handshake Authenticati on Prot ocol PPP Compressed Datagram PPP Compression Contr ol Prot ocol PPP IP Control Protocol PPP IPv6 Control Protoc ol PPP In H DLC-Li ke Framing PPP Link Control Protoc ol PPP MPLS Contr ol Prot ocol PPP Multil ink Protocol PPP Multi plexing PPP OSI Control Protoc ol PPP Pass word Authentic ation Protocol PPP VJ C ompres sion PPP-over- Ethernet Disc over y PPP-over- Ethernet Sess ion PPPMux Control Protoc ol PR OFINET DCP PR OFINET IO PR OFINET Real -Ti me Protocol P_Mul (ACP142) Pac ked Encoding Rules (ASN.1 X.691) Pac ket Cable Lawful Intercept Pac ketCable Par allel Vi rtual Fi le Syst em Par lay Dis sector Using GIOP API Plan 9 9P Poi nt-to-Point Protocol Poi nt-to-Point Tunnelling Protoc ol Por t Aggregation Protocol Por t map Post Offic e Protocol PostgreSQL

  http

  IT U-T Recommendation H.263

  ISO 9542 ESIS R outeing Infor mation Exchange Protocol

  IT U-T Recommendation H.261

  IT U-T Recommendation H.223

  IT U-T E.164 number

  IT U M.3100 Generic Net wor k Infor mati on Model

  ISystemActi vator ISystemActi vator Resol ver

  ISUP Thin Protoc ol

  IP Virtual Ser vices Sync Daemon

  3Com XNS Enc apsulati on

  3G PP2 A11 3com Net wor k Jac k 802.1Q Vir tual LAN 802.1X Aut hentication AAL t ype 2 signalling protocol ( Q.2630) AC N AF S (4.0) Replic ation Ser ver call declarations AI M Admi nistrati ve AI M Adver tisements AI M Buddylist Ser vice AI M Chat Navigation AI M Chat Ser vice AI M Direc tor y Search AI M E- mail AI M Generic Ser vice AI M ICQ AI M Invitat ion Ser vice AI M Locati on AI M Mess aging AI M OFT AI M Popup AI M Pri vac y Management Ser vi ce AI M Ser ver Side I nfo AI M Ser ver Side Themes AI M Signon AI M Statis tics AI M Trans late AI M User Lookup AN SI A-I/ F BSM AP AN SI A-I/ F DTAP AN SI IS-637-A (SMS) T eleser vice Layer AN SI IS-637-A (SMS) T ranspor t Layer AN SI IS-683-A ( OTA (M obile)) AN SI IS-801 (Loc ation Ser vices (PLD) ) AN SI Mobile Appl ication Part AO L Instant Mess enger AR CNET ASN.1 dec oding AT AoverEthernet AT M AT M AAL1 AT M AAL3/4 AT M LAN Emulat ion AT M OAM AAL AVS WLAN Capt ure header AX/ 4000 T est Bloc k Act i ve Dir ector y Setup Ad hoc On-demand Dist ance Vector R outing Protocol Adapti ve Multi-R ate Address R esoluti on Prot ocol AgentX Aggregate Server Acces s Protocol Alert Standard Forum Alt eon - Tr anspar ent Proxy Cac he Prot ocol Andrew Fi le Syst em (AF S) Apache JSer v Pr otocol v1.3 Apple Filing Protocol Apple IP-over-IEEE 1394 AppleTal k Session Protocol AppleTal k Transaction Protocol pac ket Appletal k Addres s Resol ution Protocol Application Configuration Acces s Protocol Art -Net Aruba - Ar uba Di scover y Protoc ol As ync dat a over I SDN ( V.120) As ynchronous Layered Coding AudioCodes Trunk Trac e Aut hentication Header BACnet Vi rtual Li nk Cont rol BEA Tuxedo BSSAP/BSAP Banyan Vi nes AR P Banyan Vi nes Ec ho Banyan Vi nes Frag ment ation Pr otocol Banyan Vi nes IC P Banyan Vi nes IP Banyan Vi nes IPC Banyan Vi nes LLC Banyan Vi nes RT P Banyan Vi nes SPP Base Stati on Subs ystem GPRS Protoc ol Basic Enc oding Rules (ASN.1 X.690) Bearer Independent Call Control Bi- directional Fault Detection C ontrol Message Bit Torrent Bloc ks Ext ensible Exchange Protocol Blubster/Piolet M ANOLI TO Prot ocol Boardwal k Boot Parameters Bootstrap Protocol Bor der Gateway Protocol Bui lding Automati on and Control Net wor k APDU Bui lding Automati on and Control Net wor k NPDU CBAPhysi calDevice CC SDS CD S Cler k Ser ver Calls CSM_EN CAPS Camel Cast Client Contr ol Prot ocol Certificate Management Protoc ol Certificate Request Mes sage For mat Chec k Poi nt High Availabilit y Pr otocol Chec kpoint F W-1 Cis co Aut o-RP Cis co Dis cover y Protoc ol Cis co Group Management Prot ocol Cis co HD LC Cis co Hot Standby Rout er Protocol Cis co ISL Cis co Interior Gat eway Routing Protoc ol Cis co Net Flow Cis co SLARP Cis co Ses sion M anagement Cis co Wir eless Layer 2 Clearcase NFS CoSine IPNOS L2 debug output Common I mage Generat or Inter face Common I ndustri al Prot ocol Common Open Polic y Ser vice Common Uni x Pr inting System (CUPS) Browsing Protocol Compress ed Dat a T ype Compuser ve GIF Computer Interface to M essage Distribution Configuration Tes t Protocol (loopbac k) Connectionless Light weight Dir ector y Access Protoc ol Coseventc omm Dissect or Using GIOP API Cosnaming Diss ector U sing GIOP API Cr oss Poi nt Frame Injec tor Cr yptographic M essage Syntax DC E Distr ibuted Ti me Ser vice Local Ser ver DC E Distr ibuted Ti me Ser vice Provider DC E Name Ser vi ce DC E RPC DC E Securit y ID Mapper DC E/DFS BUDB DC E/RPC BOS Ser ver DC E/RPC BUTC DC E/RPC CDS Solicitat ion DC E/RPC Conversation Manager DC E/RPC Direct or y Acl Interface DC E/RPC Endpoint Mapper DC E/RPC Endpoint Mapper v4 DC E/RPC FLDB DC E/RPC FLDB UBIK TRANSFER DC E/RPC FLDB UBIKVOTE DC E/RPC ICL R PC DC E/RPC Kerberos V DC E/RPC NCS 1.5.1 Local Loc ation Broker DC E/RPC Operations bet ween registr y ser ver replic as DC E/RPC Prop Attr DC E/RPC RS_ACCT DC E/RPC RS_BI ND DC E/RPC RS_M ISC DC E/RPC RS_PROP_ACCT DC E/RPC RS_U NIX DC E/RPC Registr y Pas s word Management DC E/RPC Registr y Ser ver Attri butes Schema DC E/RPC Registr y ser ver propagation interface - ACLs. DC E/RPC Registr y ser ver propagation interface - PGO items DC E/RPC Registr y ser ver propagation interface - pr operties and policies DC E/RPC Remote Management DC E/RPC Repser ver C alls DC E/RPC TokenSer ver Calls DC E/RPC UpSer ver DC OM DC OM ID ispatch DC OM IR emoteActi vati on DC OM O XID Resol ver DEC DNA Routing Protocol DEC Spanning Tree Prot ocol DF S Calls DG Gr yphon Prot ocol DH CP Fai lover DH CPv6 DI COM DLT_USER_A DLT_USER_B DLT_USER_C DLT_USER_D DN S Cont rol Program Ser ver DO CSIS 1.1 DO CSIS Appendi x C TLV's DO CSIS Baseline Pri vac y Key Management Attributes DO CSIS Baseline Pri vac y Key Management Request DO CSIS Baseline Pri vac y Key Management Response DO CSIS D ynami c Ser vi ce Addi tion Ac knowledge DO CSIS D ynami c Ser vi ce Addi tion Request DO CSIS D ynami c Ser vi ce Addi tion Response DO CSIS D ynami c Ser vi ce Change Ac knowledgement DO CSIS D ynami c Ser vi ce Change Request DO CSIS D ynami c Ser vi ce Change Response DO CSIS D ynami c Ser vi ce Del ete Request DO CSIS D ynami c Ser vi ce Del ete Res ponse DO CSIS I nitial R anging Message DO CSIS Mac Management DO CSIS Range Request Mess age DO CSIS Ranging Response DO CSIS Registration Ac knowledge DO CSIS Registration R equests DO CSIS Registration R espons es DO CSIS Upstream Bandwidth Allocati on DO CSIS Upstream Channel Change Request DO CSIS Upstream Channel Change Respons e DO CSIS Upstream Channel Descriptor DO CSIS Upstream Channel Descriptor T ype 29 DO CSIS Vendor Specifi c Endodings DPNSS/D ASS2- User Adaptation Layer DR SUAPI Dat a Dat a Link SWitching Dat a Stream Inter face Dat agram Congestion C ontrol Protocol Dat agram Deli ver y Prot ocol Decompressed SigComp mess age as raw text Diameter Protocol Digital Audio Acc ess Protocol Dis tance Vector Multicast Routi ng Protocol Dis tcc Dis tributed Compiler Dis tributed Chec ksum C learinghouse Protocol Dis tributed Interacti ve Si mulation Dis tributed Net wor k Prot ocol 3. 0 Domain N ame Ser vice Dublin Core Metadata ( DC) D ynamic DNS T ools Pr otocol D ynamic Trunking Protocol EN TTEC Ec ho Encapsulating Securit y Payload Endpoint Name R esoluti on Prot ocol Enhanced Interior Gateway Routing Protocol EtherNet/I P (Industrial Protocol) Etheric Ethernet Ethernet over IP Ext ended Securit y Ser vi ces Ext ensible Authentication Protoc ol Ext reme Discover y Prot ocol FC Extended Link Svc FC Fabric Configuration Ser ver FC IP FT P Data FT Ser ver Operati ons Fiber Dist ributed Data Interface Fibre Channel Fibre Channel Common Transport Fibre Channel Fabric Zone Ser ver Fibre Channel Name Ser ver Fibre Channel Pr otocol f or SCSI Fibre Channel SW_ILS Fibre Channel Securit y Protocol Fibre Channel Si ngle Byt e Command Fil e Trans fer Prot ocol (F TP) Financial I nfor mation eXchange Protoc ol Frame Frame Relay G.723 GARP Multicast Registration Pr otocol GARP VLAN Registration Protocol GPRS Net wor k s er vice GPRS Tunneling Protoc ol GSM A-I/ F BSSMAP GSM A-I/ F DTAP GSM A-I/ F RP GSM Mobile Appl ication GSM SM S TPD U (GSM 03.40) GSM Shor t Mess age Ser vice U ser Dat a GSM_SS GSS-API Generic Securi t y Ser vice Application Program Interface General Inter-OR B Protocol Generic R outing Encaps ulation Gnutella Protocol H.248 MEGACO H.324/CC SRL H.324/SR P H221NonStandar d H235-SECURIT Y-MESSAGES H323-MESSAGES HP Extended Loc al-Link Control HP Remot e Maintenanc e Protocol HP Switch Protoc ol HP-UX N et wor k Tracing and Logging Hummingbird NF S Daemon H yperSC SI H ypertext Transf er Protocol

  IC BAAccoSync

  IC BALogicalDevi ce2

  IC BALogicalDevi ce

  IC BAGroupError Event

  IC BAGroupError

  IC BABrowse2

  IC BABrowse

  IC BAAccoSer ver SRT

  IC BAPersi st2

  IC BAAccoSer ver 2

  IC BAAccoSer ver

  IC BAAccoMgt2

  ICBAAccoMgt

  IC BAAccoCallbac k2

  IC BAAccoCallbac k

  IC BAPersi st

  IC BAPhys icalDevice

  IP Device Control (SS7 over IP)

  IC BATi me

  ILMI

  IEEE802a OUI Extended Ethert ype

  IEEE 802. 11 wirel ess LAN management frame

  IEEE 802. 11 wirel ess LAN

  IEEE 802. 11 Radi otap C apture header

  IC Q Protocol

  IC BASyst emProperties

  IC BAPhys icalDevice2

  IC BAStateEvent

  IC BAState

  IC BARTAuto2

  IC BARTAuto

  IC BAPhys icalDevicePC Event

  IC BAPhys icalDevicePC

  IP O ver F C Berkeley and Java Sockets new Socket()/new ServerSocket(…) Socket.bind(…) new ServerSocket(…) ServerSocket.accept() Socket.connect(…) Socket.getOutputStream().write(...) Socket.getInputStream().read(…) Socket.close()

  For Java • Figure 4-14. The socket • Socket, ServerSocket, primitives for TCP/IP.

  • – DatagramSocket, …
A Simple Client and Server

  Java Socket Hierarchy

  

Java RMI

  • Simple, single-language RPC system for

  Java

  • – Stream-based transport as default

  mechanism

  • Invoke objects on remote objects using

  syntax for local invocations

  • – However, interfaces extend java.rmi.Remote
  • – And methods throw

  java.rmi.RemoteException checked exception

  • So not completely transparent (why?)

  Example: EHR in Java RMI…

  • What we want:

  What We Get ! "#$$ % &# $$

  

EHR.java

package ddist; import java.rmi.*; public interface EHR extends Remote { public Patient getPatient(String name) throws

  RemoteException; } serializable

Patient.java

  package ddist; import java.rmi.*; public interface Patient extends Remote { public int getDose(String medicine) throws RemoteException; public void setDose(String medicine, int dose) throws RemoteException; }

PatientServer.java

  package ddist; import java.rmi.*; import java.rmi.server.*; public class PatientServer extends UnicastRemoteObject

implements Patient {

private int dose = 0; public PatientServer() throws RemoteException { super(); } public int getDose(String medicine) throws RemoteException {

  // Ignore medicine... return dose; } public void setDose(String medicine, int dose) throws RemoteException { this.dose = dose; }

  }

EHRServer.java (1)

  package ddist; import java.rmi.*; import java.rmi.server.*; public class EHRServer extends UnicastRemoteObject implements EHR { private Patient klaus; private Patient ellen; public EHRServer() throws RemoteException { super(); klaus = new PatientServer(); ellen = new PatientServer(); klaus.setDose("aspirin", 100); } public Patient getPatient(String name) throws RemoteException { if (name.equals("Klaus")) { return klaus; } if (name.equals("Ellen")) { return ellen; } return null;

  }

  EHRServer.java (2) public static void main (String[] args) throws Exception { if (System.getSecurityManager() == null) { System.setSecurityManager(new RMISecurityManager()); } String host = "localhost"; if (args.length > 0) { host = args[0]; } System.out.println("Starting Server at " + host); EHRServer server = new EHRServer();

Naming.rebind("//" + host + "/EHRServer", server);

  }

EHRClient.java

  package ddist; import java.rmi.*; public class EHRClient { public static void main(String[] args) throws Exception { if (System.getSecurityManager() == null) { System.setSecurityManager(new RMISecurityManager()); } String host = "localhost"; if (args.length > 0) { host = args[0]; } // Use the EHR service EHR ehr = (EHR) Naming.lookup("//" + host + "/EHRServer"); String medicine = "aspirin"; String name = "Klaus"; Patient patient = ehr.getPatient(name);

System.out.println(name + " needs " + patient.getDose(medicine)

  • " unit(s) of " + medicine); name = "Ellen"; patient = ehr.getPatient(name);

    System.out.println(name + " needs " + patient.getDose(medicine)

  • " unit(s) of " + medicine); }

Java RMI Hierarchy

  ! " RMI Basic Steps

  • Server side
    • – Design and implement Remote interface

  • E.g., using UnicastRemoteObject (based on TCP/IP)
    • – Define and implement security policy
    • – Use Naming.rebind to bind server object to name

  • Client side
    • – Use Naming.lookup to find server object
    • – Invoke methods

  • Compiling and deploying
    • – Create stubs with rmic
    • – Make classes available over the network

  

RMI Parameter Passing

  • public Patient getPatient(String name)

  All parameters are input parameters • A result is the single output parameter –

  Primitive types or objects that are • java.io.Serializable are passed by value Objects that are java.rmi.Remote are passed ”by • reference”

  • – Actually an instance of <interface>_Stub (generated

  by rmic) that implements <interface> rmic Skeleton compilation not needed since • Java 1.1

  Actually Skeleton interface is deprecated – Stub compilation not needed since Java 5 • Why? •

  A Closer Look RMI Wire Protocol (1)

  • The wire format is represented by paired streams (seen from the client)
  • Output Stream
    • – <Header> <Messages>
    • – <HttpMessage>

  • Header
    • – 0x4a 0x52 0x4d 0x49 <Version> <Protocol>

  • Version
    • – 0x00 0x01
    • – 0x00 0x02

  • Protocol
    • – <StreamProtocol>
    • – <SingleOpProtocol>
    • – <MultiplexProtocol>

  • StreamProtocol
    • – 0x4b

  • Messages
    • – <Message>
    • – <Messages> <Message>

  • Message
    • – <Call>
    • – <Ping>
    • – <DgcAck>

  • Call
    • – 0x50 <CallData>

  RMI Wire Protocol (2)

  • • The wire format is represented by paired streams (seen from the

  client)

  • Input Stream
    • – <ProtocolAck> <Returns>
    • – <ProtocolNotSupported>
    • – <HttpReturn>

  • ProtocolAck
    • – 0x4e

  • Return
    • – <ReturnData>
    • – <PingAck>

  • ReturnData
    • – 0x51 <ReturnValue>

  • PingAck
    • – 0x53

  Java Message Service

  • A specification for a message queue
  • Numerous implementations
    • – SUN, IBM, …
    • – We will see an example of using ActiveMQ which is

  open source

  • Communication pattern
    • – Loosely coupled
    • – Reliable – Asynchronous – Queue or publish/subscribe

  ActiveMQ Broker

  Producer Consumer

  Summary We have introduced tools for distributed • programming in Java

  Protocol analyzer – Wireshark (previously known as Ethereal) •

  • – Java APIs

  Sockets • RMI •

JMS •

  You will get a chance to get further • acquainted with these during exercises and hand-ins…