Sign in to follow this  
Followers 0
Falcone88

PHP Pack() equivalent?

2 posts in this topic

Hello,

I've recently decided to try to make a library for the TOC protocol that many third-party AIM clients use. Until now, I've been piping the output from BSFlite for my AIM purposes, but that's very finicky and apparently not perfect. (If you must know, I'm using AIM to communicate with my cell phone)

Anyway, I've got nearly all of the other stuff figured out, but I can't get the FLAP header formatted correctly.

For explanation of TOC, please see here:

http://terraim.cvs.sourceforge.net/*checko...rc/toc/TOC1.txt

http://www2.sys-con.com/ITSG/virtualcd/Jav...aton/index.html

(I believe AOL has dropped support of TOC1 in favor of TOC2, but the few of the core stuff like FLAP headers have changed)

I've found a few ways to format this header, one particular in PHP (hence the subject) and another in Java. First, PHP:

// Specification for pack is here: http://www.php.net/manual/en/function.pack.php
pack( "aCnn", '*', $frame_type, $this->socket_client_id, strlen( $data ) );

And Java:

// str is the data you want to send, of course
// os is an initialized OutputStream
     int length = str.length()+1;
     sequence++;
     os.write((byte)'*');   
     os.write((byte)type);
     writeWord(sequence);
     writeWord((short)length);
     os.write(str.getBytes());
     os.write(0);
     os.flush();

I've played with the BinaryString() function and hex() and asc(), and have scoured the net for ways to get byte arrays like the java version, but have so far not found anything that works with AutoIT.

Any ideas on how I can do this? Thanks in advance!


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

Share this post


Link to post
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
Sign in to follow this  
Followers 0