Archived

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

How can i modi config that client send data to server only by udp?

hi,i am from china!
How can i modi config that client send data to server only by udp?

client config:
Callback.Client.CallbackServer=callback:tcp -h 192.168.2.153 -p 10000:udp -h 192.168.2.153 -p 10000:ssl -h 192.168.2.153 -p 10001
#Callback.Client.CallbackServer=callback:tcp -p 10000:udp -p 10000:ssl -p 10001
Callback.Client.Endpoints=tcp:udp:ssl
Callback.Server.Endpoints=tcp -p 10000:udp -p 10000:ssl -p 10001

#Ice.Trace.Network=1
#Ice.Trace.Protocol=1
Ice.Warn.Connections=1

Ice.Plugin.IceSSL=IceSSL:create
IceSSL.Client.CertPath=../../../certs
IceSSL.Client.Config=sslconfig.xml
IceSSL.Server.CertPath=../../../certs
IceSSL.Server.Config=sslconfig.xml
#IceSSL.Trace.Security=1


server config:
Callback.Client.CallbackServer=callback:tcp -p 10000:udp -p 10000:ssl -p 10001
Callback.Client.Endpoints=tcp:udp:ssl
Callback.Server.Endpoints=tcp -p 10000:udp -p 10000:ssl -p 10001

#Ice.Trace.Network=1
#Ice.Trace.Protocol=1
Ice.Warn.Connections=1

Ice.Plugin.IceSSL=IceSSL:create
IceSSL.Client.CertPath=/usr/share/doc/Ice-3.0.0/certs
IceSSL.Client.Config=sslconfig.xml
IceSSL.Server.CertPath=/usr/share/doc/Ice-3.0.0/certs
IceSSL.Server.Config=sslconfig.xml
IceSSL.Trace.Security=1

thank you

Comments

  • matthew
    matthew NL, Canada
    You should put only the UDP endpoints in the client side proxy. Note that if you use UDP you must only send oneway requests. There is also no point in having the SSL configuration in there, since we do not support SSL over USP.

    If you want to use UDP and you want replies of some kind then you'll need to do this explicitely using oneway UDP callbacks to the client.
  • thankyou ,i will ask you if i trouble:)
  • how can i modi demo/callback code that this example can client send string to server and server reply string to client,thank you:confused:
  • matthew
    matthew NL, Canada
    Sorry, I don't understand what you want to do. You want the client to call the server and the server reply immediately to the invocation? Something like:

    client:

    SomeTypePrx proxy = ..;
    proxy->docallback("hello world");

    server:

    void
    SomeTypeI::callback(const string& data, const Ice::Current&)
    {
    _client->callback(data);
    }
  • sorry

    sorry,my english is very bad
    my meaning:
    example of demo/callback client send string to server,that server send string to client ,this process only by udp,no tcp!
    how do i modi demo/callback example code
    :o
  • matthew
    matthew NL, Canada
    You don't need to do anything special. You can either remove all endpoints from the configuration other than udp, or you can tell the server to use only udp by calling ice_datagram() on the proxy.

    In the CallbackSenderI.cpp in the demo/Ice/callback change initiateCallback as follows:
    void
    CallbackSenderI::initiateCallback(const CallbackReceiverPrx& proxy, const Current& current)
    {
        cout << "initiating callback" << endl;
        try
        {
            CallbackReceiverPrx datagram = CallbackReceiverPrx::uncheckedCast(proxy->ice_datagram());
    	datagram->callback(current.ctx);
        }
        catch(const Exception& ex)
        {
    	cout << ex << endl;
        }
    }