示例#1
0
文件: Test.cs 项目: aivclab/pyunirpc
        private void TestConnection()
        {
            var client = new ZmqClient(6789);
            var call   = new PyUniCall("testfun", 69420, new List <object>(), new Dictionary <string, object>());

            Debug.Log(client.SendData(call));
            call.args   = new List <object>(new object[] { 5, 7 });
            call.kwargs = new Dictionary <string, object>();
            call.kwargs.Add("array", new PyUniValNdArray(new float[] { 5.5f, 6e-3f, 7.00007f, 80.08f, 9 }));
            var res = client.SendData(call);

            Debug.Log(res);
            Debug.Log((res as PyUniResult).result[0]);
        }
示例#2
0
文件: Test.cs 项目: aivclab/pyunirpc
        private void TestCall()
        {
            string json =
                @"{'rpc_tag': '__RPC_CALL__', 
                'handle': 'testfun', 
                'uid': 666, 
                'args': ['lul', 'wut'],
                'kwargs':
                    {'some string': 
                        {'rpc_tag': '__RPC_VAL_NDARRAY__', 
                        'dtype': 'int64', 
                        'shape': [3], 
                        'data': 'BgAAAAAAAAAHAAAAAAAAAAgAAAAAAAAA'}
                    }
                }";

            PyUniCall call = PyUniType.JsonConstructor <PyUniCall>(json) as PyUniCall;

            string newjson = call.PackJSON();

            print(newjson);
        }