All pastes #169619 Raw Edit

Billium

public text v1 · immutable
·published 2006-09-14 01:30 UTC
rendered paste body
  Dim psm As ParsedServerMessage
  dim dat as string
  dim lent as integer
  dim pckt as string
  dim daa as string
  dim daa2 as integer
  dim s1 as String
  dim s2 as string
  dim s3 as string
  dim command as integer
  dim data as string
  dim i as integer
  
  dat  = me.ReadAll
  
  do until len(dat) = 0
    if packetbuffer <> "" then
      dat = packetbuffer + dat
      packetbuffer = ""
    end if
    
    lent = stringtonumber(mid(dat, 1, 4))
    if lent = 0 then exit
    if lent < 8 then exit
    if lent > 10000000 then exit
    pckt = mid(dat, 1, lent)
    if len(pckt) <> lent then
      packetbuffer = pckt
      exit
    end if
    command = stringtonumber(mid(pckt, 5, 4))
    data = mid(pckt, 9)
    data = UNID(data)
    dat = mid(dat, lent + 1)
    msgbox dat
  loop
  
  
exception