MsgPack.Rpc.Client.RpcClient.Call C# (CSharp) Method

Call() public method

Calls specified remote method with specified argument and returns its result synchronously.
/// is null. /// /// is not valid. /// /// Failed to execute specified remote method. ///
public Call ( string methodName ) : MessagePackObject
methodName string /// The name of target method. ///
return MessagePackObject
		public MessagePackObject Call( string methodName, params object[] arguments )
		{
			return this.EndCall( this.BeginCall( methodName, arguments, null, null ) );
		}

Usage Example

Example #1
0
        public void TestEcho()
        {
            string mesage    = "Hello, MsgPack-RPC!!";
            long   timeStamp = MessagePackConvert.FromDateTime(DateTime.Now);

            using (var server =
                       CallbackServer.Create(
                           (messageId, args) =>
            {
                Assert.That(args, Is.Not.Null.And.Length.EqualTo(2));
                Assert.That(args[0].Equals(timeStamp));
                Assert.That(args[1].Equals(mesage));
                return(args);
            },
                           isDebugMode: true
                           ))
            {
                server.Error += (sender, e) => Console.Error.WriteLine("{0} Error:{1}", e.IsClientError ? "Client" : "Server", e.Exception);

                using (var client = new RpcClient(new IPEndPoint(IPAddress.Loopback, CallbackServer.PortNumber)))
                {
                    var result  = client.Call("Echo", timeStamp, mesage);
                    var asArray = result.AsList();
                    Assert.That(asArray[0].Equals(timeStamp));
                    Assert.That(asArray[1].Equals(mesage));
                }
            }
        }
All Usage Examples Of MsgPack.Rpc.Client.RpcClient::Call