Пример #1
0
        public Dictionary <DCP.BlockOptions, object> EndGetRequest(IAsyncResult result, int timeout_ms)
        {
            ProfinetAsyncDCPResult r = (ProfinetAsyncDCPResult)result;

            if (result.AsyncWaitHandle.WaitOne(timeout_ms))
            {
                Dictionary <DCP.BlockOptions, object> ret = r.Result;
                r.Dispose();
                return(ret);
            }
            else
            {
                r.Dispose();
                throw new TimeoutException("No response received");
            }
        }
Пример #2
0
        public DCP.BlockErrors EndSetRequest(IAsyncResult result, int timeout_ms)
        {
            ProfinetAsyncDCPResult r = (ProfinetAsyncDCPResult)result;

            if (result.AsyncWaitHandle.WaitOne(timeout_ms))
            {
                DCP.BlockErrors ret = ((DCP.ResponseStatus)r.Result[DCP.BlockOptions.Control_Response]).Error;
                r.Dispose();
                return(ret);
            }
            else
            {
                r.Dispose();
                throw new TimeoutException("No response received");
            }
        }