/// <summary cref="CommunicationObject.OnEndOpen" /> protected override void OnEndOpen(IAsyncResult result) { try { TcpAsyncOperation <int> operation = (TcpAsyncOperation <int>)result; operation.End(Int32.MaxValue); } catch (Exception e) { throw ServiceResultException.Create(StatusCodes.BadInternalError, e, "Could not open UA TCP channel factory."); } }
/// <summary cref="System.ServiceModel.Channels.RequestContext.EndReply(IAsyncResult)" /> public override void EndReply(IAsyncResult result) { try { TcpAsyncOperation <uint> operation = (TcpAsyncOperation <uint>)result; operation.End(Int32.MaxValue); } catch (Exception e) { Utils.Trace(e, "Could not send reply to request."); } }
/// <summary cref="CommunicationObject.OnEndClose" /> protected override void OnEndClose(IAsyncResult result) { try { TcpAsyncOperation <int> operation = (TcpAsyncOperation <int>)result; operation.End(Int32.MaxValue); } catch (Exception e) { m_fault = ServiceResult.Create(e, StatusCodes.BadInternalError, "Could not close UA TCP listener."); Utils.Trace(m_fault.ToLongString()); Fault(); } }
/// <summary cref="ChannelListenerBase{T}.OnEndAcceptChannel" /> protected override IReplySessionChannel OnEndAcceptChannel(IAsyncResult result) { try { TcpAsyncOperation <IReplySessionChannel> operation = (TcpAsyncOperation <IReplySessionChannel>)result; return(operation.End(Int32.MaxValue)); } catch (Exception e) { m_fault = ServiceResult.Create(e, StatusCodes.BadInternalError, "Error accepting a new UA TCP reply channel."); Utils.Trace(m_fault.ToLongString()); Fault(); return(null); } }
/// <summary cref="IReplyChannel.EndTryReceiveRequest" /> public bool EndTryReceiveRequest(IAsyncResult result, out System.ServiceModel.Channels.RequestContext context) { context = null; TcpAsyncOperation <RequestContext> operation = (TcpAsyncOperation <RequestContext>)result; try { context = operation.End(Int32.MaxValue); return(true); } catch (TimeoutException) { return(false); } catch (Exception e) { m_fault = ServiceResult.Create(e, StatusCodes.BadInternalError, "Could not receive request from a UA TCP channel."); Utils.Trace(m_fault.ToLongString()); return(false); } }