IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

avec Java Discussion :

RMI connexion distante


Sujet :

avec Java

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre éclairé Avatar de Pecose
    Homme Profil pro
    Batiment
    Inscrit en
    Février 2013
    Messages
    311
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 38
    Localisation : France, Alpes Maritimes (Provence Alpes Côte d'Azur)

    Informations professionnelles :
    Activité : Batiment
    Secteur : Bâtiment

    Informations forums :
    Inscription : Février 2013
    Messages : 311
    Par défaut RMI connexion distante
    Bonjour à tous,

    J'ai quelques problèmes avec mon serveur RMI lorsqu'il s'agit de de me connecter à une machine distante
    (en local ça marche)
    Voila l'erreur:

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    C:\Users\thomas>java -jar C:\Users\thomas\Desktop\ZEngine.jar
    java.rmi.ConnectException: Connection refused to host: 192.168.0.17; nested exception is:
            java.net.ConnectException: Connection timed out: connect
            at sun.rmi.transport.tcp.TCPEndpoint.newSocket(Unknown Source)
            at sun.rmi.transport.tcp.TCPChannel.createConnection(Unknown Source)
            at sun.rmi.transport.tcp.TCPChannel.newConnection(Unknown Source)
            at sun.rmi.server.UnicastRef.newCall(Unknown Source)
            at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
            at java.rmi.Naming.lookup(Unknown Source)
            at SSJEngine.Save.client(Save.java:73)
            at pecose.billos.Main.keyPressed(Main.java:73)
            at PecEngine.KListener.keyPressed(KListener.java:22)
            at java.awt.Component.processKeyEvent(Unknown Source)
            at java.awt.Component.processEvent(Unknown Source)
            at java.awt.Container.processEvent(Unknown Source)
            at java.awt.Window.processEvent(Unknown Source)
            at java.awt.Component.dispatchEventImpl(Unknown Source)
            at java.awt.Container.dispatchEventImpl(Unknown Source)
            at java.awt.Window.dispatchEventImpl(Unknown Source)
            at java.awt.Component.dispatchEvent(Unknown Source)
            at java.awt.KeyboardFocusManager.redispatchEvent(Unknown Source)
            at java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(Unknown Source)
            at java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(Unknown Source)
            at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(Unknown Source)
            at java.awt.DefaultKeyboardFocusManager.dispatchEvent(Unknown Source)
            at java.awt.Component.dispatchEventImpl(Unknown Source)
            at java.awt.Container.dispatchEventImpl(Unknown Source)
            at java.awt.Window.dispatchEventImpl(Unknown Source)
            at java.awt.Component.dispatchEvent(Unknown Source)
            at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
            at java.awt.EventQueue.access$500(Unknown Source)
            at java.awt.EventQueue$3.run(Unknown Source)
            at java.awt.EventQueue$3.run(Unknown Source)
            at java.security.AccessController.doPrivileged(Native Method)
            at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
            at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
            at java.awt.EventQueue$4.run(Unknown Source)
            at java.awt.EventQueue$4.run(Unknown Source)
            at java.security.AccessController.doPrivileged(Native Method)
            at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
            at java.awt.EventQueue.dispatchEvent(Unknown Source)
            at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
            at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
            at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
            at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
            at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
            at java.awt.EventDispatchThread.run(Unknown Source)
    Caused by: java.net.ConnectException: Connection timed out: connect
            at java.net.DualStackPlainSocketImpl.connect0(Native Method)
            at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)
            at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
            at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
            at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
            at java.net.PlainSocketImpl.connect(Unknown Source)
            at java.net.SocksSocketImpl.connect(Unknown Source)
            at java.net.Socket.connect(Unknown Source)
            at java.net.Socket.connect(Unknown Source)
            at java.net.Socket.<init>(Unknown Source)
            at java.net.Socket.<init>(Unknown Source)
            at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(Unknown Source)
            at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(Unknown Source)
            ... 44 more
    Voila mon code:

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    public void server(int port) {
    	try {
    		LocateRegistry.createRegistry(port);
    		od = new ServerUnicastRemote(game);
     
    		String url = "rmi://" + InetAddress.getLocalHost().getHostAddress() + ":" + port + "/SSJEngine";
    		System.out.println("Enregistrement de l'objet avec l'url : " + url);
    		Naming.rebind(url, od);
     
    	} catch (Exception e){e.printStackTrace();}
    }
     
    public void client(String ip, int port) {
    	try {
    		stub = (ServerRemote) Naming.lookup("rmi://" + ip + ":" + port + "/SSJEngine");
    		System.out.println("rmi://" + ip + "/SSJEngine");
    	} catch (Exception e) {e.printStackTrace();}
    }
    J'utilise PortMapper pour ouvrir le port 1099,
    je ne suis pas chez moi et je n'ai pas les identifiants pour accéder à la freebox.
    Quel est mon erreur?
    Merci de votre aide.

  2. #2
    Expert éminent
    Avatar de tchize_
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Avril 2007
    Messages
    25 482
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 46
    Localisation : Belgique

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Avril 2007
    Messages : 25 482
    Par défaut
    1) pourquoi tu as besoin d'ouvrir quelque chose dans le routeur? L'ip est en réseau local, ça ne passe pas par le routeur, c'est une adresse non routable.
    2) est-ce que le serveur écoute bien sur l'adresse externe du serveur et non pas sur 127.0.0.1

    A noter que t'as une erreur coté client et tu nous donne le code du serveur, ce n'est pas très relevant en soit.

  3. #3
    Membre éclairé Avatar de Pecose
    Homme Profil pro
    Batiment
    Inscrit en
    Février 2013
    Messages
    311
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 38
    Localisation : France, Alpes Maritimes (Provence Alpes Côte d'Azur)

    Informations professionnelles :
    Activité : Batiment
    Secteur : Bâtiment

    Informations forums :
    Inscription : Février 2013
    Messages : 311
    Par défaut
    Alors, non, c'est le code du client et du serveur.
    Les deux ont exactement le même code et l'on décide d'être client ou serveur en appuyant sur un bouton.
    Dans ce cas, ça appel la fonction client() ou la fonction server() présenter plus haut.

    L'erreur ce produit coté client...
    Faut savoir que moi et le réseau, ça fait 2.
    Je n'y comprend foutrement rien du tout.

    Pour ce qui est de l'IP, j'utilise c'est celle là pour le serveur:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    InetAddress.getLocalHost().getHostAddress()
    Ce qui me donne: "192.168.0.17" que j'utilise du coup pour le client, qui est mon IP local.

    Tu me dit que l'IP est en réseau local, mais du coup j'utilise quel IP?
    Je suis allez sur mon-ip.com j'ai trouver 78.230.228.6, j'ai tester et en local ça marche plus.
    C'est censé marcher en distant?

  4. #4
    Expert éminent
    Avatar de tchize_
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Avril 2007
    Messages
    25 482
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 46
    Localisation : Belgique

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Avril 2007
    Messages : 25 482
    Par défaut
    Faire du réseau sans comprendre le réseau ca risque d'être compliqué. Où sont le client et le serveur physiquement. Comment sont ils reliés entre eux.

  5. #5
    Membre éclairé Avatar de Pecose
    Homme Profil pro
    Batiment
    Inscrit en
    Février 2013
    Messages
    311
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 38
    Localisation : France, Alpes Maritimes (Provence Alpes Côte d'Azur)

    Informations professionnelles :
    Activité : Batiment
    Secteur : Bâtiment

    Informations forums :
    Inscription : Février 2013
    Messages : 311
    Par défaut
    Le serveur est chez moi, le client chez un pote à l'autre bout de Nice. Et on a tout les deux une bidulebox.

  6. #6
    Expert éminent
    Avatar de tchize_
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Avril 2007
    Messages
    25 482
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 46
    Localisation : Belgique

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Avril 2007
    Messages : 25 482
    Par défaut
    dans ce cas, coté serveur tu dois ouvrir les ports sur ta bidulebox et les fowarder vers ta machine interne. Coté client, c'est l'ip de la bidulebox qu'il faut entrer.

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Problème de connexion distante
    Par tripper.dim dans le forum MS SQL Server
    Réponses: 4
    Dernier message: 14/01/2005, 14h03
  2. problème de connexion distante
    Par nico31120 dans le forum PostgreSQL
    Réponses: 3
    Dernier message: 21/12/2004, 12h58
  3. Comment etablir une connexion distante sur une bd sql server
    Par sessime dans le forum Bases de données
    Réponses: 2
    Dernier message: 08/11/2004, 13h19
  4. [JDBC]Connexion distante a SQLServer
    Par FreshVic dans le forum MS SQL Server
    Réponses: 14
    Dernier message: 01/07/2004, 11h06
  5. [VB.NET] Connexion distante sur serveur UNIX
    Par Toftof dans le forum Windows Forms
    Réponses: 5
    Dernier message: 30/06/2004, 17h18

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo