Friday, April 08, 2005

XmlSockets in Flash

XmlSockets in Flash provide a simple way to obtain a persistent connection with a server. However, the server must be aware of Flash's language in order for the communication to work. It appears that XmlSocket's onData()-function, the function used to receive data, won't trigger until some specific end-of-file (or stream or whatever) bytes have been received (a zero-byte). I created a simple test server in C#, and in order to make onData() trigger in Flash, the following had to be added to the string being sent:

char EOF = (char) 0x00;
Thus, the server sends:
binaryWriter.Write(stringIWantedToSend + EOF);


Post a Comment

<< Home

En blogg kan være et godt verktøy for en som i litt for stor grad glemmer de små og store tingene som utgjør livet. Dette er min reserve- hukommelse.