1 / 6

Networkable solutions

Networkable solutions. Using sockets we can pass objects back and forth between client and server, but we’re limited Cannot call methods on objects between client/server, only send objects and respond to protocols Conceivably we’ll run into firewall problems

kaia
Download Presentation

Networkable solutions

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Networkable solutions • Using sockets we can pass objects back and forth between client and server, but we’re limited • Cannot call methods on objects between client/server, only send objects and respond to protocols • Conceivably we’ll run into firewall problems • RMI, Remote Method Invocation, can fix both these problems • Clients call methods across machines, on objects running in other JVMs • Built on top of HTTP, so can (in theory) be used through firewalls • Different in 1.1/1.2, requires a fair amount of bookkeeping overhead to set up

  2. Object streams, passing objects • ObjectInputStream and ObjectOutputStream provide mechanisms for passing objects between clients • Wrap streams around/in other streams, e.g., socket streams via stream decorator pattern • Send copies of objects, different from standard Java object model where everything is a reference • Objects sent must implement Serializable interface • Flag interface, no methods • All fields (object graph) written, objects not written more than once, references used for already-written objects • Possible to customize how objects are serialized using writeObject/readObject or Externalizable interface • Fields labeled as transient are not written

  3. RMI ideas • Think of clients and servers, though this distinction is blurred • In jdk 1.2, server-side objects can call client object methods, so really distributed computing • Still, an initial server/rmiregistry begins the RMI process • JVMs on different machines execute, objects communicate with each other between JVMs • Sockets used underneath, either TCP/IP or HTTP or … customizable e.g., SSL • Classes can either be located in all JVMs, or transferred/downloaded using HTTP codebase • Codebase is also used in applets, but restricted to original web page as root

  4. Applet codebase • JVM executing in browser has different capabilities than “regular” JVM • Looks in codebase as its CLASSPATH, also uses client/browser side CLASSPATH • Codebase is relative to location of web page originating the applet for security reasons • Implications for downloading swing.jar?

  5. RMI information/basics • http://java.sun.com/products/1.2/docs/guide/rmi/codebase.html • http://java.sun.com/docs/books/tutorial/rmi/

  6. Downloading code in RMI

More Related