This commit is contained in:
shoopea 2020-06-14 22:07:45 +02:00
parent 362a8ea83b
commit f6c99c60c3

View File

@ -32,15 +32,20 @@ func main() {
b, err = conn.ReadByte()
logErrorDebug(err, "conn.ReadByte")
p.PType = uint8(b)
if p.PLength <= 3 {
logInfoAlert("Wrong packet length")
break
}
d := make([]byte, p.PLength-3)
for {
_, err := conn.Read(d[len(d):])
logErrorDebug(err, "conn.Read")
if len(d) == p.PLength-3 {
if len(d) == int(p.PLength-3) {
break
}
}
logInfoDebug("Packet read : len : %d / type : %d", p.PLength, p.PType)
}
}