[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: Newbie question

Kroeger, Simon (ext)

1/6/2006 10:47:00 AM


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