Help with a script to listen to a port
Re: Help with a script to listen to a port
Try this:
Edit: Missing ) in If (StrLen(Received) < Result) {
Code: Select all
Recv:
...
...
Received := ""
Received := StrGet(&Buffer, RecvLen, "CP0")
If (StrLen(Received) < Result) {
Received := ""
Loop, %RecvLen%
Received .= FormatIntHex(NumGet(Buffer, A_Index - 1, "UChar"), "Char")
}
Code: Select all
FormatIntHex(Int, Typ := "Auto") {
; Returns the hexadecimal string represention of the passed integer value.
; Int - Integer value in the range of -9223372036854775808 to 9223372036854775807
; Typ - Type to determine the size of the returned hex string.
; You may pass one of the keys in the 'Types' object. If the parameter is omitted or 'Auto'
; is passed explicitely, the size will be determined as 'Int64', 'Int', 'Short', or 'Char'
; according to the value of 'Int'.
Static Types := {Int64: 16, Int: 8, Color: 6, Short: 4, Char: 2, Ptr: (A_PtrSize = 8 ? 16 : 8)}
If Int Is Not Integer
Return ""
If (Typ = "Auto")
If (Int <= 127) && (Int >= -128)
Len := 2
Else If (Int <= 32767) && (Int >= -32768)
Len := 4
Else If (Int <= 2147483647) && (Int >= -2147483648)
Len := 8
Else
Len := 16
Else If Typ Is Integer
Len := Typ
Else If !(Len := Types[Typ])
Return ""
VarSetCapacity(Hex, 17 << !!A_IsUnicode, 0)
If (DllCall("Shlwapi.dll\wnsprintf", "Str", Hex, "Int", 17, "Str", "%016I64X", "UInt64", Int, "Int") = 16)
Return SubStr(Hex, StrLen(Hex) - Len + 1)
Return ""
}
Re: Help with a script to listen to a port
yay, that works, thanks a lot just me, you are so cool!
Oh, god, I can configure packets differently, so that I could bind each of them to a specific command, that's mega-awesome!
Oh, god, I can configure packets differently, so that I could bind each of them to a specific command, that's mega-awesome!
question := (2b) || !(2b) © Shakespeare.
Re: Help with a script to listen to a port
You're welcome!
Who is online
Users browsing this forum: No registered users and 144 guests