Jump to content

BinaryString


Recommended Posts

hum sorry to make you repeat yourself....

what are [sOH][sO], [EOT] and [DC3]^ Do you want the ascii codes for the letters S, O, and H all strung together?

The raw bytes are obtained by using the Binary() function as is (using autoit 3.2.4.0)

so for example

$bin=Binary("This is a text string")
msgbox(0,"" ,$bin)

will return a string of binary bytes that represent the text string...this is what you asked for but it doesn't sound like you believe so...

Link to comment
Share on other sites

No, [sOH], etc. are single characters. It looks like SOH in white letters on a black, rounded-rectangle background. I can't copy it because it's not really ansii, I guess.

Yes, I know about Binary. Unfortunately, using that doesn't work. I'm trying to send this data over TCP, and using that isn't accepted/understood by the server

My Code:- _TocLib - UDF for TOC protocol (The simplified one used by 3rd party AIM/ICQ clients)

Link to comment
Share on other sites

All data sent over TCP/IP is binary data though, there is no way around this, when you send a text string with TCPSend() all it does it convert it to binary anyways.

Since the charactors dont show up on a console write how bout using binary() to view what the exact binary data is. [sOH] does not seem signgificant in any way, im guessing it's more a on issue with how the console is displaying the data. Can you get a screen shot of it so we can all see what's going on?

Link to comment
Share on other sites

Yes, but you can send raw ansii and such. TOC protocol uses plain text for its commands.

I agree that [sOH] is how the console is displaying the data. It's just showing the ascii representation of the byte, I guess.

What, specifically, would you like a screenshot of?

My Code:- _TocLib - UDF for TOC protocol (The simplified one used by 3rd party AIM/ICQ clients)

Link to comment
Share on other sites

Well, it's all binary data in the end, ascii is just one way of interpritung it. In that sense TOC cannot use 'plain text' for communitcation.

I just wanted a screenshot of the console when it's displaying the data as [sOH] ect...

Is the problem in this case then what is being sent with TCPSend()?

maybe you could compaire then what the old version's "to send" data was and what the actual raw data sent was in comparision to how the new version does it.

Link to comment
Share on other sites

Yes, I think the problem is with how it gets sent over TCP, or rather the way TCP understand that data. I'm not sure how to word it correctly...

The SOH and stuff, I guess, must just be how the old version represented the data; it's just the ascii representation of the byte value: http://www.autoitscript.com/autoit3/docs/appendix/ascii.htm

I guess the new version displays the hex code value...? That still doesn't help me, though

My Code:- _TocLib - UDF for TOC protocol (The simplified one used by 3rd party AIM/ICQ clients)

Link to comment
Share on other sites

Got it! FINALLY it works! I had to do some fiddling with my parsing functions to deal with the receiving of data, but it works now.

If you're interested, my new _BinaryNumber function is:

Func _BinaryNumber($iNum, $iLength=2)       
    Local $b, $numStarted=false, $out="", $prepend=""
        
    $b = Binary($iNum)          
    for $i=BinaryLen($B) to 1 Step -1
        if Chr( BinaryMid($b, $i, 1) ) <> Chr(0) or $numStarted Then
            if not $numStarted then $numStarted = true
            $out &= Chr( BinaryMid($b, $i, 1) )
        EndIf
    Next    

    if BinaryLen($out) < $iLength Then
        for $i=1 to $iLength-BinaryLen($out)
            $prepend &= Chr(0)
        Next
    EndIf
    
    return $prepend&$out
EndFuncoÝ÷ Ø l¢Øb²+-çÚé¢ëAv«É+kxºw-ȺǬzÜz)íéh)ìz«ÇºØ­Á«'yç^w}ÚºÚ"µÍ[È[TÝ[È
    ÌÍÜÑ]JBBSØØ[  ÌÍØH[J   ÌÍÜÑ]JBSØØ[   ÌÍÛÝ]H  ][ÝÉ][ÝÂBYÜ    ÌÍÚOLHÈ[S[  ÌÍØBBIÌÍÛÝ]  [ÏH
Ú[SZY
    ÌÍØ  ÌÍÚKJH
H
BS^]
    ÌÍÛÝ]
B[[
Edited by Falcone88

My Code:- _TocLib - UDF for TOC protocol (The simplified one used by 3rd party AIM/ICQ clients)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...