Archived

This forum has been archived. Please start a new discussion on GitHub.

I need ICE C# client call my ICE C++ server

but the string is not well, What should I do ?

Comments

  • mes
    mes California
    In order to help you, we need you to provide as much information as possible about the problem.

    First, please always specify the Ice versions you are using, as well as the platform(s) and compiler(s).

    Next, describe the problem. It would be very useful for us to see code samples from your client and server. Also, if it appears that data is not being transferred correctly, please show the contents of the data in the client and in the server. If any exceptions are being raised, show them as well.

    Take care,
    - Mark
  • Which string encoding is IceCS to use? UTF8 ?

    I try to translate incoming string from UTF8 to my locale encoding, but fail.
  • Originally posted by mes
    In order to help you, we need you to provide as much information as possible about the problem.

    First, please always specify the Ice versions you are using, as well as the platform(s) and compiler(s).

    Next, describe the problem. It would be very useful for us to see code samples from your client and server. Also, if it appears that data is not being transferred correctly, please show the contents of the data in the client and in the server. If any exceptions are being raised, show them as well.

    Take care,
    - Mark

    sorry. :-)

    the Ice/IceCS version is 1.5.1, win 2000/vs.net 2003(7.1.3091)/.net 1.1(1.1.4322)

    picecs of slice:

    struct UserMessage
    {
    // User name
    string User;
    // password
    string Pwd;
    // user group
    string Group;
    // session id
    string Session;
    };

    //
    struct Connection
    {
    // user Id
    long Id;
    };

    class Test
    {
    /**
    * Shutdown the server.
    **/
    idempotent void shutdown();

    Connection Login2( UserMessage user ) throws
    jf::GenericError;

    ...
    }

    the picecs of C# client side:

    public jf.TestPrx GetTest()
    {
    if ( null == m_test )
    {
    string[] args = new string[1];
    args[ 0 ] = "TestClient";

    string proxy_name = "Test:tcp -p 52618";

    m_properties = Ice.Util.createProperties();
    m_communicator = Ice.Util.initializeWithProperties(ref args, m_properties);

    Ice.ObjectPrx basePrx = m_communicator.stringToProxy( proxy_name );
    m_test = jf.TestPrxHelper.checkedCast( basePrx.ice_twoway().ice_timeout(-1).ice_secure(false) );
    }

    return m_test;
    }

    public long Login( string usr, string pwd, string grp, string sn )
    {
    jf.UserMessage user = new jf.UserMessage();
    user.User = usr;
    user.Pwd = pwd;
    user.Group = grp;
    user.Session = sn;

    jf.TestPrx t = GetTest();
    jf.Connection cn = t.Login2( user );
    return cn.Id;
    }

    the C++ server side:

    ::jf::Connection TestI::Login2(
    const ::jf::UserMessage& user,
    const ::Ice::Current&)
    {
    std::cerr << user.User << std::endl;
    ...
    }

    I'm chinese. I try to write a chinese words in user field:

    ....
    client.Login( "’†‘Žš", "pwd", "", "" );

    the C++ server side receive a string, but is not readable, is it utf8 ?
    I tryed to translate from utf8 to my locate encoding, It still not readable.
  • Sorry again.

    Ice is work fine, It's my wrong. Sorry !
    <:-)