Hi ppl.
I am traying to return all output data from a game site. In this case it´s from the statistics page. All output data is between <td
and </td>, sow i am using the $bfind to search all that data.
All the incoming data is about 32 Kb.
The very strange thing is that the sockread some times is scrambling the data received, making repeat some output values.
I will try to explain with real examples...
The images will be showed only the bug error itself and one line above and other line under (between the error).
In the Image1 you have:
You have to look at the "status window", at the "@OutputData window" and at the small firefox window will show the html source code.
The other is not very necessary but you can see it for more information

line 15 It´s ok
line 16 Not ok, has you can see the last 4 chars are "ana:" and on the source code you will noted that after the "</tr>" is
"</tbody>". I think for any reason he have jump out to the final output value off line 15 the word "Registados na última semana:" and
put thoses 3 last char´s on this line.
line 17 Not ok, has we have noted on the last line he have jump out to one line before and sow he have continued on that line, sow he
will repeat all.
line 18 Not ok, again it´s the same. It continues.
line 19 All it´s ok. This is the correct line for output
line 20 All it´s ok
line 21 All it´s ok. The "class="tableheader"" have exchange placed with the "align="center"" becouse the firefox source code view
have exchange it.
Has you can see on this firts example the mirc is scramble the data received
After you make again the connection to retrive all data, the error can be in other places and that can depend´s off the machines you
have.I have already ask to "Sais" on DaLnet to run the script, when he have done it the errors aren´t in the same place has mine, sow
i figured out that mybe the mirc program make thoses randon errors.
I will put more 2 or 3 examples images only.
The code part that make those output´s are :
on *:SockRead:Game*: {
set -u0 %Bytes 800
sockread $var( %Bytes, 1).value &data
if ( $SockName == GameStats ) {
bwrite $+( $SockName, .html) -1 -1 &data
if ( $gettok( $bvar( &data, 1, %Bytes).text, 1, 13) == HTTP/1.1 302 Found ) {
$iif( %GameMsgInfo == on, msg %GameSetChan, echo -s) You need to make the login $+ $chr(44) Automatic redirect to do it.
Sockclose Game*
SockOpen GameGetCookie xxxxxxx.xxx.xx 80
}
Else {
window @Status 1 1 1135 200
window @OutputData 1 201 1135 200
;Here it will start the search code
;This if is the add the incomplet code missing that can´t be correct read btween the Sockread
if ( $hget( DataIncomplecta, Estatisticas) != $null ) {
bset &DataTemp 1 $hget( DataIncomplecta, Estatisticas)
bset -t &Data 1 $+( $bvar( &DataTemp, 1-).text, $bvar( &Data, 1-).text)
echo -s Data Added 4 $bvar( &DataTemp, 1-).text
hfree DataIncomplecta
}
set %x 1
;while the beguining text "<td" is found
while ( $bfind( &Data, %x, <td) != 0 ) {
;Sets the x var for the bfind value. Line before this one
set %x $bfind( &Data, %x, <td)
;If the final text "</td>" is found, them the output sentense is complet
if ( $bfind( &Data, %x, </td>) != 0 ) {
;This y var i use to set the lengh off the amout off charsets that i must use on the $bvar identifier.
set %y $calc( $calc( $bfind( &Data, %x, </td>) + 5) - %x)
;This is whery the output text is showed including all the html code, beguining in the "<td" search until the final "</td>"
search
aline -p @Status 12 %TimeCount 3Complet $remove( $bvar( &data, %x, %y).text, $chr(9), $chr(10), $chr(13)) 4<td in 12
$bfind( &Data, %x, <td) and 4</td> in12 $bfind( &Data, %x, </td>)
aline -p @OutputData 12 %TimeCount $remove( $bvar( &data, %x, $calc( %y + 60)).text, $chr(9), $chr(10), $chr(13))
TextoSaida $remove( $bvar( &data, %x, %y).text, $chr(9), $chr(10), $chr(13))
inc %TimeCount
}
;;If the final text "</td>" is NOT found, them the output sentense is NOT complet
if ( $bfind( &Data, %x, </td>) == 0 ) {
;Once the final text was not found, it will be ncessary keep the rest off the sentence somewhery, in this case in hash
tables
;It will keep all text from the beguinning "<td" search until the end off sockread data
aline -p @Status 12 %TimeCount 4Incomplet $bvar( &Data, %x, $bvar( &Data, 0)).text 4<td in 12 $bfind( &Data, %x, <td)
and 4</td> in12 $bfind( &Data, %x, </td>) 4Next line will add this info
hadd -m DataIncomplecta Estatisticas $bvar( &Data, %x, $bvar( &Data, 0))
}
inc %x
}
}
}
}
Other´s two images examples


Thanks for all