Presentation is loading. Please wait.

Presentation is loading. Please wait.

CS 5204 Fall 00 1 Distributed Programming low level: sending data among distributed computations higher level: supporting invocations among distributed.

Similar presentations


Presentation on theme: "CS 5204 Fall 00 1 Distributed Programming low level: sending data among distributed computations higher level: supporting invocations among distributed."— Presentation transcript:

1 CS 5204 Fall 00 1 Distributed Programming low level: sending data among distributed computations higher level: supporting invocations among distributed computations network is visible (to the programmer) programmer must deal with many details network is invisible (to the programmer) programmer focuses on application

2 CS 5204 Fall 00 2 Distributed Data Communication Socket

3 CS 5204 Fall 00 3 Distributed Data Communication Java Classes DataOutputStream (PrintStream) Socket DataInputStream

4 CS 5204 Fall 00 4 Basic Socket Usage client // Establish Socket Connection Socket cs; int portno = 5678; cs = new Socket(``server'', portno); //Establish Data Streams clin = new DataInputStream( cs.getInputStream()); clout = new PrintStream( cs.getOutputStream()); server // Establish Socket Connection ServerSocket ss; Socket sin; int portno = 5678; ss = new ServerSocket(portno); Socket sin = s.accept(); // Establish Data Streams srout = new PrintStream( sin.getOutputStream()); srin = new DataInputStream) sin.getInputStream());

5 CS 5204 Fall 00 5 Client Side Code class SocketTest { public static void main( String[] args) { try { Socket t = new Socket(``java.sun.com'', 13); DataInputStream is = new DataInputStream(t.getInputStream()); boolean more = true; while( more ) { String str = is.readLine(); if (str == null) more = false; else System.out.println(str); } catch (IOException e) { System.out.println(``Error'' + e); } }

6 CS 5204 Fall 00 6 Server Side Code class EchoServer { public static void main( String[] args) { try { ServerSocket s = new ServerSocket(8189); Socket = incoming = s.accept(); DataInputStream in = new DataInputStream(incoming.getInputStream()); PrintStream out = new PrintStream(incoming.getOutputStream()); System.out.println( ``Hello! Enter BYE to exit. \r''); boolean done = false; while (!done) { String str = in.readLine(); if (str == null)done = true; else { out.println(``Echo: `` + str + ``\r''); if (str.trim().equals(``BYE'')) done = true; } incoming.close(); } catch (Exception e) { System.out.println(e); } }

7 CS 5204 Fall 00 7 Remote Procedure Call Calling Procedure Called Procedure args results args Calling Procedure Client Stub RPC Transport args results RPC Transport Called Procedure Server Stub request reply results

8 CS 5204 Fall 00 8 Remote Procedure Call Issues generating stubs serialization or arguments and return values heterogeneity of data representations locating servers in a distributed environment authentication of called and calling procedures semantics of invocation (at-most-once, at-least-once)

9 CS 5204 Fall 00 9 Serialization x y z b c a x y z c transforming a typed, highly structured object into a stream of bytes. Issues: how to represent base types (i.e. int) how to represent structured types (arrays) how to deal with references (pointers) how to treat duplicated objects

10 CS 5204 Fall 00 10 Interface Definition Language Calling Procedure Client Stub RPC Transport args results RPC Transport Called Procedure Server Stub request reply results IDL description translator

11 CS 5204 Fall 00 11 Simple IDL Example module Counter { interface Count { attribute long sum; long increment(); }; From: Ole Arthur Bernsen

12 CS 5204 Fall 00 12 IDL Elements module modulename { exception exceptionName { [type pname]* }; typedef type newtype; interface newInterface { oneway type fname(in type pname1); attribute newtype; }; interface newInterface2 : newInterface { type fname2 (out newInterface pname3) raises exceptionName; }; From: Ole Arthur Bernsen

13 CS 5204 Fall 00 13 Remote Object Systems invoking object invoked object proxy objects network objects

14 CS 5204 Fall 00 14 Corba From: Object Mangagement Group Corba: Common Object Request Broker Architecture ORB: Object Request Broker Goal: interoperability among application components written in different programming languages executing on heterogeneous architectures communicating over different networks.

15 CS 5204 Fall 00 15 Role of the Object Request Broker From Doug Schmidt Application interfaces: interfaces for a specific application Domain interfaces: interfaces shared across applications in a given application domain (publishing) Common Facilities: generic services that might be needed in several domains (document structure) Object Services: commonly needed across all applications (e.g., naming, trading)

16 CS 5204 Fall 00 16 Elements of Corba From:Kate Keahey (kksiazek@cs.indiana.edu)

17 CS 5204 Fall 00 17 Role of IDL in Corba From: Object Mangagement Group

18 CS 5204 Fall 00 18 Elements of Corba From Doug Schmidt

19 CS 5204 Fall 00 19 Corba and Java Corba is still needed to fill in the gaps between Java and system developed in other languages.


Download ppt "CS 5204 Fall 00 1 Distributed Programming low level: sending data among distributed computations higher level: supporting invocations among distributed."

Similar presentations


Ads by Google