Example #1
0
 public void Write(Dimse dimse)
 {
     lock(this)
     {
         pcid = dimse.pcid();
         System.String tsUID = fsm.GetAcceptedTransferSyntaxUID(pcid);
         if (tsUID == null)
         {
             throw new System.SystemException();
         }
         ((Dimse) dimse).TransferSyntaxUID = tsUID;
         fsm.FireWrite(dimse);
         if (pDataTF == null)
         {
             pDataTF = new PDataTF(fsm.WriteMaxLength);
         }
         pDataTF.OpenPDV(pcid, cmd = true);
         Stream outs = new PDataTFOutputStream(this);
         Command c = dimse.Command;
         try
         {
             c.Write(outs);
         }
         finally
         {
             outs.Close();
         }
         if (c.HasDataset())
         {
             pDataTF.OpenPDV(pcid, cmd = false);
             outs = new PDataTFOutputStream(this);
             try
             {
                 dimse.WriteTo(outs, tsUID);
             }
             finally
             {
                 outs.Close();
             }
         }
         FlushPDataTF();
     }
 }
Example #2
0
 internal virtual void Write(PDataTF data)
 {
     throw new SystemException();
 }
Example #3
0
 public void Write(PDataTF data)
 {
     FireWrite(data);
     try
     {
         lock( stream )
         {
             state.Write(data);
         }
     }
     catch (IOException ioe)
     {
         if (assocListener != null)
             assocListener.Error(assoc, ioe);
         throw ioe;
     }
 }
Example #4
0
 internal override void Write(PDataTF tf)
 {
     try
     {
         tf.WriteTo(m_fsm.stream);
     }
     catch (IOException e)
     {
         m_fsm.ChangeState(m_fsm.STA1);
         throw e;
     }
 }
Example #5
0
        /// <summary>
        /// Read next DICOM PDU
        /// </summary>
        /// <returns></returns>
        private bool NextPDataTF()
        {
            if (buf == null)
            {
                buf = new byte[fsm.ReadMaxLength + 6];
            }
            PduI pdu = fsm.Read(timeout, buf);
            if (pdu is PDataTF)
            {
                pDataTF = (PDataTF) pdu;
                return true;
            }
            if (pdu is AReleaseRP)
            {
                return false;
            }
            if (pdu is AReleaseRQ)
            {
                fsm.Write(AReleaseRP.Instance);
                return false;
            }
            if( pdu == null )
                return false;

            throw new PduException("Received " + pdu, (AAbort) pdu);
        }
Example #6
0
 public PDV(PDataTF pDataTF, int off)
 {
     m_pDataTF = pDataTF;
     m_off = off;
 }