Java Programming: Advanced Topics 1 Networking Programming Chapter 11.

Slides:



Advertisements
Similar presentations
Message Passing Vs Distributed Objects
Advertisements

What is RMI? Remote Method Invocation –A true distributed computing application interface for Java, written to provide easy access to objects existing.
1 Chapter 9 Network Programming. 2 Overview Java has rich class libraries to support network programming at various levels. There are standard classes.
Copyright © 2001 Qusay H. Mahmoud RMI – Remote Method Invocation Introduction What is RMI? RMI System Architecture How does RMI work? Distributed Garbage.
15-May-15 RMI Remote Method Invocation. 2 “The network is the computer” Consider the following program organization: If the network is the computer, we.
Advanced Programming Rabie A. Ramadan Lecture 4. A Simple Use of Java Remote Method Invocation (RMI) 2.
Java Remote Method Invocation (RMI) In Java we implement object systems: O1O2 O3 thread 1thread 2 execution scheme JVM 1JVM 2 distribution scheme.
Remote Method Invocation
1 Distributed Systems Distributed Objects & Remote Invocation CORBA Dr. Sunny Jeong. Mr. Colin Zhang With Thanks.
Network Programming Chapter 11 Lecture 6. Networks.
FONG CHAN SING (143334) WONG YEW JOON (143388). JAVA RMI is a distributive system programming interface introduced in JDK 1.1. A library that allows an.
Remote Method Invocation Chin-Chih Chang. Java Remote Object Invocation In Java, the object is serialized before being passed as a parameter to an RMI.
Advanced Java Class Network Programming. Network Protocols Overview Levels of Abstraction –HTTP protocol: spoken by Web Servers and Web Clients –TCP/IP:
1 HANDOUT 14 Remote Method Invocation (RMI) BY GEORGE KOUTSOGIANNAKIS THIS DOCUMENT CAN NOT BE REPRODUCED OR DISTRIBUTED WITHOUT TH E WRITTEN PERMISSION.
CORBA Case Study By Jeffrey Oliver March March 17, 2003CORBA Case Study by J. T. Oliver2 History The CORBA (Common Object Request Broker Architecture)
Sockets  Defined as an “endpoint for communication.”  Concatenation of IP address + port.  Used for server-client communication.  Server waits for.
EEC-681/781 Distributed Computing Systems Lecture 5 Wenbing Zhao Department of Electrical and Computer Engineering Cleveland State University
1. Introducing Java Computing  What is Java Computing?  Why Java Computing?  Enterprise Java Computing  Java and Internet Web Server.
CS3771 Today: network programming with sockets  Previous class: network structures, protocols  Next: network programming Sockets (low-level API) TODAY!
Introduction to Remote Method Invocation (RMI)
How Does Remote Method Invocation Work? –Systems that use RMI for communication typically are divided into two categories: clients and servers. A server.
Practical Issues of RPCCS-4513, D-Term Remote Procedure Call Practical Issues CS-4513 Distributed Computing Systems (Slides include materials from.
Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All rights reserved L22 (Chapter 25) Networking.
Lesson 3 Remote Method Invocation (RMI) Mixing RMI and sockets Rethinking out tic-tac-toe game.
Common Object Request Broker Architecture CORBA. RMI is a simplified version of CORBA that does fairly well CORBA is all-singing and all-dancing Multiple.
1 Java Programming II Java Network II (Distributed Objects in Java)
Understanding the CORBA Model. What is CORBA?  The Common Object Request Broker Architecture (CORBA) allows distributed applications to interoperate.
CORBA Celsina Bignoli Enterprise Computing Corporation have similar computing environments: –mixed set of HW platforms –a mixed set.
Enterprise Java Beans Java for the Enterprise Server-based platform for Enterprise Applications Designed for “medium-to-large scale business, enterprise-wide.
+ A Short Java RMI Tutorial Usman Saleem
Cli/Serv.: rmiCORBA/131 Client/Server Distributed Systems v Objectives –introduce rmi and CORBA , Semester 1, RMI and CORBA.
1 Distributed Systems Distributed Objects & Remote Invocation II (CORBA VS DCOM) Dr. Sunny Jeong. With Thanks to.
11 September 2008CIS 340 # 1 Topics To examine the variety of approaches to handle the middle- interaction (continued) 1.RPC-based systems 2.TP monitors.
Java Remote Method Invocation (RMI) ). Distributed Systems  a collection of independent computers that appears to its users as a single coherent system.
1 Java RMI G53ACC Chris Greenhalgh. 2 Contents l Java RMI overview l A Java RMI example –Overview –Walk-through l Implementation notes –Argument passing.
1. I NTRODUCTION TO N ETWORKS Network programming is surprisingly easy in Java ◦ Most of the classes relevant to network programming are in the java.net.
Spring/2002 Distributed Software Engineering C:\unocourses\4350\slides\DefiningThreads 1 RMI.
CORBA/IDL Common Object Resource Broker Architecture (CORBA) Interface Definition Language (IDL) Object Management Group (OMG) ( Specification.
Silberschatz, Galvin, and Gagne  1999 Applied Operating System Concepts Chapter 15: Distributed Communication Sockets Remote Procedure Calls (RPCs) Remote.
Java Remote Method Invocation RMI. Idea If objects communicate with each other on one JVM why not do the same on several JVM’s? If objects communicate.
RMI remote method invocation. Traditional network programming The client program sends data to the server in some intermediary format and the server has.
RMI Remote Method Invocation Distributed Object-based System and RPC Together 2-Jun-16.
Distributed Objects and Middleware. Sockets and Ports Source: G. Coulouris et al., Distributed Systems: Concepts and Design.
 Remote Method Invocation  A true distributed computing application interface for Java, written to provide easy access to objects existing on remote.
CORBA Common Object Request Broker Architecture. Basic Architecture A distributed objects architecture. Logically, an object client makes method calls.
 Common Object Request Broker Architecture  An industry standard developed by OMG to help in distributed programming.
Java Remote Method Invocation (RMI) Overview of RMI Java RMI allowed programmer to execute remote function class using the same semantics as local functions.
Remote Method Invocation by James Hunt, Joel Dominic, and Adam Mcculloch.
Remote Method Invocation A Client Server Approach.
(C) 2003 University of ManchesterCS31010 Lecture 14: CORBA.
UMBC Distributed Computing with Objects RMI/Corba CMSC 432 Shon Vick.
Remote Method Invocation RMI architecture stubs and skeletons for remote services RMI server and client in Java Creating an RMI Application step-by- step.
1 RMI Russell Johnston Communications II. 2 What is RMI? Remote Method Invocation.
Liang, Introduction to Java Programming, Fifth Edition, (c) 2005 Pearson Education, Inc. All rights reserved Chapter 29 Remote Method.
Remote Method Invocation Internet Computing Workshop Lecture 17.
Java Distributed Computing
Distributed Computing
Java Distributed Computing
MCA – 405 Elective –I (A) Java Programming & Technology
Remote Method Invocation
Java RMI CS-328 Internet Programming.
What is RMI? Remote Method Invocation
Remote Method Invocation
Knowledge Byte In this section, you will learn about:
Creating a Distributed System with RMI
Creating a Distributed System with RMI
Remote Method Invocation
Copyright 1999 B.Ramamurthy
Java Chapter 5 (Estifanos Tilahun Mihret--Tech with Estif)
Presentation transcript:

Java Programming: Advanced Topics 1 Networking Programming Chapter 11

Java Programming: Advanced Topics 2 Objectives Perform network I/O using the core classes in the package java.net Write programs that establish connections to URLs and perform stream I/O between URLs Read and write data to local and remote sites using TCP/IP sockets and datagram sockets

Java Programming: Advanced Topics 3 Objectives (Cont.) Use Remote Method Invocation (RMI) to develop classes of objects that are accessible from a server Learn the steps involved in compiling and deploying an application that uses RMI

Java Programming: Advanced Topics 4 Objectives (Cont.) Be introduced to the Java Naming and Directory Interface (JNDI) Discover the relationship between CORBA, RMI-IIOP, and the Java Interface Definition Language (IDL)

Java Programming: Advanced Topics 5 Introduction The Java platform includes a package java.net to perform input and output (I/O) operations over the network Core classes of the java.net package support URLs, TCP/IP sockets, or datagram sockets

Java Programming: Advanced Topics 6 Working with URLs URLs begin with a protocol specification followed by a colon and two forward slashes (://) and the host name, along with optional file and port information To exchange information with a URL, you must create a URLConnection by calling the method openConnection for a URL

Java Programming: Advanced Topics 7 The Use of the URL and URLConnection Objects

Java Programming: Advanced Topics 8 The Use of the URL and URLConnection Objects (Cont.)

Java Programming: Advanced Topics 9 Working with URLs (Cont.) Uniform Resource Identifier (URI) technology has become commonly used in technical specifications in place of the term URL The class java.net.URI contains a method, toURL, which can be used to construct a URL object from a URI object

Java Programming: Advanced Topics 10 Working with Sockets Socket: an abstraction of the end points of connections between processes or applications The Java platform supports two types of sockets: –TCP/IP –datagram

Java Programming: Advanced Topics 11 TCP/IP Sockets A TCP/IP socket is connection-oriented Create a Socket object, ask the socket for its input stream and output stream To perform stream I/O to and from a TCP/IP socket, use the methods Socket.getInputStream and Socket.getOutputStream Use the ServerSocket class to create the server side of a TCP/IP socket

Java Programming: Advanced Topics 12 Datagram Sockets Datagram sockets send packets that contains information that identifies the network destination in addition to the content of your message The class DatagramPacket represents these packets The User Datagram Protocol (UDP) used by these sockets makes no attempt to recover from lost or damaged packets

Java Programming: Advanced Topics 13 An Example Datagram Socket Server Program

Java Programming: Advanced Topics 14 An Example Datagram Socket Server Program (Cont.)

Java Programming: Advanced Topics 15 An Example Datagram Socket Server Program (Cont.)

Java Programming: Advanced Topics 16 An Example Datagram Socket Client Program

Java Programming: Advanced Topics 17 An Example Datagram Socket Client Program (Cont.)

Java Programming: Advanced Topics 18 Remote Method Invocation Remote Invocation Method (RMI) is a technology that allows programmers to call directly the methods of Java objects that reside on other systems Client programs use Object Request Brokers (ORBs) to obtain references to these remote objects Marshaling: the technique used to forward the parameters to the remote object

Java Programming: Advanced Topics 19 Remote Method Invocation Stub classes act as local surrogates for remote objects to provide access to the remote objects Skeleton classes marshal and unmarshal parameters and return values between the stub and the remote object On the remote system, a skeleton object receives this byte stream and uses a technique called unmarshaling to deserialize the contents of the parameter list

Java Programming: Advanced Topics 20 Flow of a Remote Method Call

Java Programming: Advanced Topics 21 Developing a Remote Class of Objects The Remote interface is a marker interface To make an interface available remotely via RMI, it should extend the java.rmi.Remote All methods in the interface must indicate that they might throw a java.rmi.RemoteException

Java Programming: Advanced Topics 22 Remote Interface

Java Programming: Advanced Topics 23 Developing an RMI Server Class

Java Programming: Advanced Topics 24 Developing an RMI Server Class (Cont.)

Java Programming: Advanced Topics 25 Developing an RMI Client Class

Java Programming: Advanced Topics 26 Developing an RMI Client Class (Cont.)

Java Programming: Advanced Topics 27 Running the Server and Client Programs Compile server and client files using the javac compiler Create the stub and skeleton classes by using the rmic command Start the RMI registry program by typing: rmiregistry Start the server program and supply the codebase for the stub and skeleton files Start the client program

Java Programming: Advanced Topics 28 JNDI Sun developed the Java Naming and Directory Interface (JNDI) JNDI is not itself a naming or directory service, but is a unified interface to multiple naming and directory services that already exist for enterprise development

Java Programming: Advanced Topics 29 JNDI Packages

Java Programming: Advanced Topics 30 JNDI Packages (Cont.)

Java Programming: Advanced Topics 31 Corba, RMI-IIOP, and IDL Common Object Request Broker Architecture (CORBA) is a generic architecture for defining and using remote objects A consortium of companies, known as the Object Management Group (OMG), developed the CORBA standard CORBA ORBs use Internet Inter-ORB Protocol (IIOP)

Java Programming: Advanced Topics 32 Corba, RMI-IIOP, and IDL (Cont.) The interfaces of CORBA objects are defined using a language called Interface Definition Language (IDL) Java platform SDK provides a tool called idlj that generates the Java bindings for the specified IDL file

Java Programming: Advanced Topics 33 Summary The java.net package supports network programming The core classes of the java.net package support URLs, TCP/IP sockets, or datagram sockets To exchange information with a URL, you must create a URLConnection object TCP/IP sockets are connection-oriented, and datagram sockets use packets

Java Programming: Advanced Topics 34 Summary (Cont.) Remote Invocation Method (RMI) is a technology that allows programmers to call directly the methods of Java objects that reside on other systems The Java Naming and Directory Interface (JNDI) is a unified interface to multiple naming and directory services that already exist for enterprise development Common Object Request Broker Architecture (CORBA) is a more generic architecture for defining and using remote objects