JXTA e Relay - PowerPoint PPT Presentation

1 / 25
About This Presentation
Title:

JXTA e Relay

Description:

Secondo la filosofia JXTA tutto ci che collegabile in rete, pu diventare un Peer ... Protected Peer connects first to external Peer. Nice Firewall allows ... – PowerPoint PPT presentation

Number of Views:100
Avg rating:3.0/5.0
Slides: 26
Provided by: namep68
Category:
Tags: jxta | relay | rete

less

Transcript and Presenter's Notes

Title: JXTA e Relay


1
JXTA e Relay
  • Realizzazione di una Jxta Chat

2
Peer
  • Definizione
  • Secondo la filosofia JXTA tutto ciò che è
    collegabile in rete, può diventare un Peer
  • Es
  • Host, Cellulari, Router,

3
Virtual Network
4
Introduzione
JXTA Virtual Network
Protocolli
Peer
Super Peer
Edge Peer
Randevouz
Relay
5
Relay
Firewall
Peer
Peer
  • Problem
  • How should a host beyond Firewall become a Peer
    ?
  • Solution
  • Using a Relay

Relay
Peer
Peer
Peer
6
Case 1 Outgoing Connection
  • Protected Peer connects first to external Peer
  • Nice Firewall allows outgoing TCP connections
  • Strict Firewall allows only HTTP connections for
    using WWW service

Peer
TCP stable
Peer
HTTP request
Peer
HTTP answer
For each request only one answer is allowed
7
Case 2 Incoming Connection
Peer
  • External Peer tries to connect to protected Peer
  • Firewall blocks the packets

Blocked
Peer
8
Using Realy
PeerB
  • Using a Relay
  • 1) PeerA connects to Relay (TCP or HTTP it
    dipends on what firewall allows)
  • 2) PeerB connects to Relay and leave its message
    for PeerA
  • 3) Relay routes the connection request to PeerA
    that connects to PeerB (TCP or HTTP it dipends on
    what firewall allows)

2
3
Relay
1
PeerA
Relay keeps the msg until PeerA isnt ready to
retrive it
9
Dimostration
  • TCP 160.78.28.2362057 160.78.28.2339701
    ESTABLISHED
  • This line has been taken from a netstat na
    logfile

Its a stable TCP connection
- Protected Peer IP - Random port means this
peer has started the connection
  • - Free Peer IP
  • Fixed port means
  • this peer has recived
  • the connection request

10
Services
Randevouz
It keeps PipeAdv in cache
  • Discovery Service
  • Pipe Service

Pipe
DiscoveryService. Publish(PipeAdv)
PipeService.Create
DHT Chosen Randevouz
Server Peer
Randevouz
Pipe Advertisement
11
Services
Randevouz
  • Discovery Service
  • Pipe Service

Relay should use a Randevouz
DHT Chosen Randevouz
Relay
DiscoveryService. query
Relay should act as Randevouz Himself and calc
DHT
Client Peer
Randevouz
12
Query responses
Randevouz
  • Asynchronous mechanism for query results

Relay
Client Peer
Query response
13
Opening Pipe
Pipe
  • Opening Pipe

Relay
Access to remote pipe
Client Peer
Server Peer
Pipe Adv
14
Implementation
Relay
  • Usually its Server Peer to start the connection
    toward client, but in this case its viceversa,
    only this way the firewall allows it

Blocked
Server Peer
Client Peer
TCP Connection Implements the JXTA Pipe
15
Problem Privileges of JVM
  • Standard JVM
  • java MyClass
  • No Restrictions
  • JXTA requires privileges to open files,
  • It works ok with this JVM

Standard JVM
OK
JXTA
File
File
File
16
Problem Privileges of JVM
  • JVM Browser Plugin
  • Many Restrictions for Security Reasons
  • JXTA requires privileges to open files,
  • It doesnt work

Plugin JVM
Noooo
JXTA
File
File
File
17
Solution Engine, Applet, RMI
ENGINE
APPLET
Plugin JVM
Standard JVM
RMI
Applet
JXTA
Browser
File
File
File
18
Engine
  • Module running JXTA
  • Runs in the Standard JVM with no restrictions
  • It does the Real Work
  • It passes results up to the Applet
  • It acts as Console

Engine Code
DiscoveryService PipeService
JXTA
19
Applet
Browser
Applet
  • Runs in the restricted JVM Browser Plugin
  • Its only task is to recive data from the engine
    and show them on the browser

RMI
Restrictions
No Restriction
Engine Code
20
RMI
  • RMI Remote Method Invocation
  • It allows data exchange between 2 different
    contexts
  • Automatic Data Marshaling

21
Interface Definition
  • To invoke Remote Methods its needed an Interface
    that defines Remote Methods Name, Parameters,
  • public interface MyPipeServer extends Remote
  • public void addTempMsgListener() throws
    RemoteException

One of my Remote Methods It must be declared that
throws RemoteException
My remote Interface must extend Remote (defined
by RMI)
22
Interface Implementation
  • Remote Interface must be implemented by a class
    extending UnicastRemoteObject
  • public class MyPipeServerImpl extends
    UnicastRemoteObject implements MyPipeServer
  • UnicastRemoteObject has this characteristics
  • Gives the illusion that the RemoteObject is local
  • Provides comunication between 2 sides with TCP
  • Provides a protocol for invocation, params and
    results

23
Registration
  • Once created an instance of the
    RemoteUnicastObject it has to be registered in
    the RMI Registry
  • Once Registered in RMI Registry it can be
    accessed from any other context
  • Naming.rebind(myapp.RMIHost myapp.RMIPort
    myapp.RMIServerName, myapp)

Name my object is registered with in the registry
24
Accessing a Remote Object
  • A Remote Object is used by its Remote Interface
  • It can taken querying the RMI Registry
  • tMsgListener (TempMsgListener)
    Naming.lookup(RMIHost RMIPort RMIClientName)

Remote Interface for the Remote Object
Name the object is registered with in the
registry
Interface to use locally to invoke The Remote
Object
25
Whats RMI Registry ?
  • Its an executable
  • Opens a TCP Port and waits for registrations or
    lookups query
  • Its the bridge between the 2 contexts
  • Server Where the Remote Object Implementation
    stays
  • Client Where the Remote Interface is used
Write a Comment
User Comments (0)
About PowerShow.com