/*public Task WaitForConnection() * { * CancellationTokenSource cts = new CancellationTokenSource(); * CancellationToken token = cts.Token; * return Task.Run(() => * { * int maxRetries = 100; * int currentTry = 1; * while (!IsConnected() && currentTry <= maxRetries) * { * currentTry++; * Thread.Sleep(100); * } * * if (currentTry > maxRetries) * { * cts.Cancel(); * } * }, token); * }*/ // CallService function called from upper layer (i.e. some MonoBehavior), returns a Task public Task <ServiceReply> CallService(ServiceRequest srq) { //Debug.Log("CallService: " + srq.Topic); return(Task.Run(() => netmqServiceClient.CallService(srq))); }
// CallService function called from upper layer (i.e. some MonoBehavior), returns a Task public Task <ServiceReply> CallService(ServiceRequest srq) { return(Task.Run(() => netmqServiceClient.CallService(srq))); }