Forum: Ruby Re: Newbie question

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Kroeger, Simon (ext) (Guest)
on 2006-01-06 12:50
(Received via mailing list)
Hi again,

there where some obvious errors left:
--------------------------------------------------------------
def ae_6 session
  pdu, pduLen = session.read(5).unpack('cN')
  buffer = session.read(pduLen)

  calledAETitle, callingAETitle, itemType, itemLength =
      buffer.unpack('x4A16A16x35Cxn')

  contextName=buffer[72, itemLength]

  start = 72 + itemLength
  while start < pduLen
    start += getNextPresentationContext(buffer[start..-1])
    puts "Finish = #{start - 1} outside proc"
  end
end

def getNextPresentationContext(pdu)
  it, il, presContextId, itemType, itemLength =
      pdu.unpack('CxnCx3Cxn')

  abstractSyntax=pdu[12, itemLength]

  start = 12 + itemLength
  loop do
    return start if pdu[start] != 64

    itemLength, =pdu[start + 2, 2].unpack('n')
    transferSyntax=pdu[start + 4, itemLength]

    puts "id=#{presContextId}, AbstractSyntax =#{abstractSyntax},
TxSyntax=#{transferSyntax}"
    start += 4 + itemLength
  end
end
--------------------------------------------------------------

cheers

Simon
This topic is locked and can not be replied to.