It's the reverse of what I said:
1 is 00 00 00 01 in bytes, but the bytes are reversed during transport so it becomes 01 00 00 00
258 becomes 02 01 00 00 == 2 + 1*256 + 0*256^2 + 0 * 256^3
alias numtoint {
var %1 = $1, %r
if (%1 !isnum 0-4294967295) return
var %r = $calc(%1 % 256), %1 = $int($calc(%1 / 256))
var %r = %r $calc(%1 % 256), %1 = $int($calc(%1 / 256))
var %r = %r $calc(%1 % 256), %1 = $int($calc(%1 / 256))
var %r = %r $calc(%1 % 256), %1 = $int($calc(%1 / 256))
return %r
}
alias inttonum {
if (!$regex($1-,^(\d+) (\d+) (\d+) (\d+)$)) return
return $calc( ((($regml(4) * 256 + $regml(3) ) * 256 + $regml(2) ) * 256 + $regml(1) ))
}
I colored the output so you know what belongs together:
17 00 00 00 02 00 00 00 03 00 00 00 61 73 64 61 73 64 61 73 64 61 73 64 61 00 00bset &requestid 1
$numtoint(1)bset &serverdata 1
$numtoint(3)bset &auth 1
61 73 64 61 73 64 61 73 64 61 73 64 61 0 0OR
bset -t &auth1 1
asdfasdasd; you still need to append the 0 after that text, maybe easiest to just
bset &auth2 1
0 0var %len = $calc(
4+
4+ $len(
asdfasdasd) +
1+
1)
bset &len 1
$numtoint(%len)You can use your solution to append everything to one &binvar, but since you have to convert it back to digits, it can get longer than 900 chars very easily. Just using multiple sockwrites should not give a problem. Otherwise, you can use the /bcopy command to copy everything to a single &binvar without the $bvar conversions.
Glad it works though