Précédent   Forum du club des développeurs et IT Pro > Autres langages > Autres langages > CORBA
CORBA Forum d'entraide et de discussion sur le développement distribué avec CORBA & les ORB
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse
 
Outils de la discussion
Publicité
'
Vieux 04/07/2011, 17h48   #1
bahidev
Invité de passage
 
bahi hassan
Inscription : octobre 2009
Messages : 11
Détails du profil
Informations personnelles :
Nom : bahi hassan

Informations forums :
Inscription : octobre 2009
Messages : 11
Points : 2
Points : 2
Par défaut recupére variable in et inout coté serveur

je travail avec corba mon probléme comment je peut recupére mes variable coté serveur

fichie IDL
Code :
1
2
3
4
5
interface Data
	{
	void Etudiant(in string nom , inout long data);
	};
fichier serveur
Code :
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

import org.omg.PortableServer.*;
import org.omg.PortableServer.POA;

public class serveur
{
    public static void main(String args[])
    {
    	try{   
      org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init(args, null);
     
      servant dataRef = new servant(orb);
     
      POA rootpoa =     POAHelper.narrow(orb.resolve_initial_references("RootPOA"));
     rootpoa.the_POAManager().activate();
      
      org.omg.CORBA.Object ref = rootpoa.servant_to_reference(dataRef);

     Data href = DataHelper.narrow(ref);
     
     String oir = orb.object_to_string(href);
     java.io.PrintWriter out = new java.io.PrintWriter(new  java.io.FileOutputStream("c:/dev/Data.ref"));
     out.println(oir);
     out.close();
   
     System.out.println("server ready ....");
    orb.run();
            
         }
} catch (Exception e) { System.err.println("ERROR: " + e); e.printStackTrace(System.out); } }

}
voila l’implémentation de classe servant
Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import org.omg.CORBA.*;     // All CORBA applications need these classes.
import org.omg.PortableServer.*;
import org.omg.PortableServer.POA;
class servant extends DataPOA {
    private ORB orb;
public servant(ORB orb) {
      this.orb = orb;
    }
    public void Etudiant(String nom, IntHolder data) {
       if(data.value==0){
           System.out.println("L'etudiant :"+nom+" vient de se connecter .");         
       }
       else {
            System.out.println("L'etudiant : "+nom+" a participé : "+data.value+" fois");
        
        }
    }
}
Comment je peut recupére les 2 variables data et nom dans la classe serveur j'ai aucun problème coté client et merci d'avance
bahidev est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 05/07/2011, 18h42   #2
CorbAddict
Membre éclairé
 
Homme Julien Enoch
Architecte technique
Inscription : septembre 2006
Messages : 219
Détails du profil
Informations personnelles :
Nom : Homme Julien Enoch
Âge : 37
Localisation : France

Informations professionnelles :
Activité : Architecte technique
Secteur : High Tech - Éditeur de logiciels

Informations forums :
Inscription : septembre 2006
Messages : 219
Points : 308
Points : 308
Bonjour,

Citation:
Comment je peut recupére les 2 variables data et nom dans la classe serveur j'ai aucun problème coté client et merci d'avance
Je ne comprend pas bien le problème... Les variables data et nom sont reçus en paramètres de l'opération "public void Etudiant(String nom, IntHolder data)".
Il n'y a rien à faire d'autre que d'utiliser ces variables, comme tu le fais dans tes System.out.println().
CorbAddict est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse
Outils de la discussion

Navigation rapide


Fuseau horaire GMT +2. Il est actuellement 20h28.


 
 
 
 
Partenaires

Hébergement Web