public void OnNetworkError(IClientService nwClientSrvc, string msg, AbortSource abortSource, AbortReason abortReason, Object userCookie) { if (abortSource == AbortSource.Server) { (userCookie as TransactionCookie).Log("Network Error: Server not responding"); } else if (abortSource == AbortSource.Client) { (userCookie as TransactionCookie).Log("Network Error: Your device isn't connected to a network"); } }
public static void SendAbort(Association asc, AbortSource abortSource = AbortSource.DICOM_UL_SERV_PROVIDER, AbortReason reason = AbortReason.REASON_NOT_SPECIFIED) { if (asc.Stream.CanWrite) { var abort = new Abort { Source = abortSource, Reason = reason }; var message = abort.Write(); asc.Stream.Write(message, 0, message.Length); } }
public override long Read(Stream stream) { long bytes = 0; if (stream.CanRead) { EndianBinaryReader reader = new EndianBinaryReader(stream, Endian.Big); long start = stream.Position; type = (ProtocolDataUnit.Type)reader.ReadByte(); reserved1 = reader.ReadByte(); length = reader.ReadInt32(); reserved2 = reader.ReadByte(); reserved3 = reader.ReadByte(); source = (AbortSource)reader.ReadByte(); reason = (AbortReason)reader.ReadByte(); bytes = stream.Position - start; } return(bytes); }
/// <summary> /// Aborts the association. /// </summary> internal void Abort(AbortSource source, AbortReason reason) { AssertValid(); if (!IsOpen()) { throw new Exception("Association not open."); } // the exception should be thrown on the foreground service thread abortexception = new AssociationAbortedException(source, reason, "Association aborted at the client's request."); State = State.Aborted; // the association is aborted, free any services awaiting respsonses foreach (ServiceClass service in services) { service.completeEvent.Set(); } AssociateAbortPdu abort = new AssociateAbortPdu(); abort.Source = source; abort.reason = reason; Send("A-ABORT", abort); }
public AssociationAbortedException(AbortSource source, AbortReason reason, string message, Exception innerException) : base(message, innerException) { this.source = source; this.reason = reason; }
public AssociationAbortedException(AbortSource source, AbortReason reason) : base() { this.source = source; this.reason = reason; }