Home Help Center

send an object client -> server

Hi everybody,

I am Arnaud and new on this forum.

I have to do a project using Ice. I have one client and one server (both in Java)
The client has to send an object (which has previously been created by the client) to the server.

I made some programms. I think what I did is not very good.

I never used Ice before. I am a newbee in middleware.

Could you tell me if what I did is correct? Could you give me some clues to improve it ?

I thank you very much

I join the sources of my programms

Comments

  • matthewmatthew NL, CanadaMember Matthew NewhookOrganization: ZeroC, Inc.Project: Internet Communications Engine ✭✭✭
    I'm sorry, but unless you have specific questions about Ice its very hard to help you.
  • xdmxdm La Coruña, SpainAdministrators, ZeroC Staff Jose Gutierrez de la ConchaOrganization: ZeroC, Inc.Project: Ice Developer ZeroC Staff
    Hi arnaud
    I have to do a project using Ice. I have one client and one server (both in Java)
    The client has to send an object (which has previously been created by the client) to the server.

    if you want to send a class using Ice, this class must be defined previous in slice. and you need and slice method that accep this clas by value.
     module A
     {
                 class MyClass
                 {
                          int a;
                          long b;
                          String c;
                 };
    
                interface test
                {
                           void sendClass(MyClass c);
                };
     };
    
    your servant must use the slice defined method to receive the class by value
        void sendClass(MyClass c,Ice.Current current)
       {
                    //here procces the class that received from client
       }
    
    And your client must create the class and send it using the slice method that accept it as a param

    note that MyClassI is your java implementation for MyClass defined type and testPx is a proxy to the test interface register in your server
                MyClass c=new MyClassI(1,2,3);
                testPx.sendClass(c);
    

    if you want send class from server to client, you must read about ObjectFactories in Ice book
  • arnaudarnaud Member
    Thank you very much !!

    :)
Sign In or Register to comment.