Effectiement :
readlength = BitConverter.ToUInt16(Byteswap(bytedata, 2), 0)
sourceport = BitConverter.ToUInt16(Byteswap(bytedata, 22), 0)
destinationport = BitConverter.ToUInt16(Byteswap(bytedata, 24), 0)
'Get Protocol Type
If bytedata(9) = 6 Then
Typez = "TCP"
ElseIf bytedata(9) = 17 Then
Typez = "UDP"
Else
Typez = "???"
End If
'Get IP from and to
ipfrom = New IPAddress(BitConverter.ToUInt32(bytedata, 12))
ipto = New IPAddress(BitConverter.ToUInt32(bytedata, 16))
On peut en déduire qu'il va déjà jusque 24 pour récupérer le port...
Le code à la base commençait à 26 :
For i = 26 To readlength - 1
If Char.IsLetterOrDigit(Chr(bytedata(i))) = True Then
stringBytes = stringBytes & Chr(bytedata(i))
Else
stringBytes = stringBytes & "."
End If
stringz = stringz & bytedata(i).ToString("X2") & " | "
Next
Cependant, en laissant 26 et en faisant un :
parsing.parsing(bytedata)
Eh bien j'ai un problème de taille .. :/