mIRC Home    About    Download    Register    News    Help

Print Thread
Null Bytes, Sockets and binvars, oh god #106319 28/12/04 02:16 PM
Joined: Feb 2004
Posts: 15
O
OuttaControlX Offline OP
Pikka bird
OP Offline
Pikka bird
O
Joined: Feb 2004
Posts: 15
ok im getting null bytes from a socket, issue is i need them... so i can the replace them in an alias whitch i must use!, but mirc dont proccess nullbytes, and im not a binvar pro, so if you could help or understand what im asking please post an examplre of a sockread sending binvar data with null bytes to an alias to be replaced in and only in that alias, not before it in the sockread

Re: Null Bytes, Sockets and binvars, oh god #106320 28/12/04 07:43 PM
Joined: Dec 2002
Posts: 1,922
O
Online Offline
Hoopy frood
Offline
Hoopy frood
O
Joined: Dec 2002
Posts: 1,922
This code is untested, but you'll get the idea:

On *:sockread:socket_name:{
  • [color:blue];
    ; Read the data into a binary variable,
    ; 950 bytes (characters) at a time
    ; to avoid a "line too long" error with /echo.
    ;
    sockread 950 &var
    while $sockbr {
    ;
    ; Replace zeroes with $chr(64) which is @.
    ;

    breplace &var 0 64
    echo -s Sockread: $bvar(&var, 1-).text
    ;
    ; Since we fetch the data in 950-byte chunks,
    ; there still may be something left in the buffer.
    ;
    ; The job of this loop is to read the data
    ; until the buffer is emptied.
    ;

    sockread 950 &var
    }
}[/color]