[Spread-users] connecting to spread with Flash

Jonathan Stanton jonathan at cnds.jhu.edu
Thu May 12 16:24:34 EDT 2005


hello,


On Thu, May 12, 2005 at 11:44:08PM +0530, Francis Chary wrote:
> Thanks for the info Jonathan,
> 
> Your message is good news and bad news, actually. The XMLSocket in Flash is 
> ok with the long-term communication you're talking about, that's the good 
> news. It's one tcp connection, that just stays open until you explicitly 
> close it. The bad news is that there is no way to control when the onData 
> callback is called. Flash basically looks for a single byte with value zero, 
> then takes that as end of file and runs the onData function which you've 

this is a bit strange. What happens if the contents of the message 
happen to contain a byte with binary value 0? It sounds like they assume 
that the message will only be a valid C string? (no null bytes) This is 
not true for Spread messages. They are sent in a binary format not 
ascii. 


> So, it's definitely tricky. Since Spread just assumes that the client knows 
> when the message is over, and because Macromedia doesn't let you edit the 
> socket code, I think I'll have problems making the Flash onData callback 
> work in the way you suggest. I would much prefer to code in the format of 
> the message into the Actionscript, but I just don't think it's possible. Is 
> there any way I could just edit the server's code to send that extra byte at 
> the end of each message? Where would be the best place to look, if I wanted 
> to do that?

You could, although I don't want to merge a change like that (and you 
will have to fix the valid 0 bytes in teh data stream). 

In the daemon all client-server communication is coded in the session.c 
file. There are Sess_Write() and related  functions which 
handle sending messages to the client. You could probably insert a few 
lines to send the specific characters needed for Flash after each 
message. If you don't need any regular client libaries to work with your 
modified daemon then it should be straightforward. if you do need 
regular clients to keep working you will also have to fix the length 
fields and datastructures so that messages still fit (after you add a 
byte or so) and will have to modify the client libraries also.

> 
> I really appreciate your help, I'm sorry if I'm asking daft questions.

Hope it helps,

Jonathan

-- 
-------------------------------------------------------
Jonathan R. Stanton         jonathan at cs.jhu.edu
Dept. of Computer Science   
Johns Hopkins University    
-------------------------------------------------------




More information about the Spread-users mailing list