Can XMLSocket send more than once in a frame?
I have a XMLSocket and I call send twice in the same function. The first se开发者_如何转开发nd works but the second does not? Does XMLSocket have a restriction to only send one message per frame? Do I have to queue messages and have an onEnterFrame function that checks the queue and sends one message for a frame?
You have to flush the output buffer when you use the Socket class. Example:
public static function write(msg:String):void
{
socket.writeUTFBytes(msg);
socket.flush();
}
However, you're saying that you're using the XMLSocket class? That one provides less lower level posibilities and should already do the flushing for you so I don't think you'd have this problem if your code is correct.
You could try to use the lower level Socket class, and flush the output buffer manually every time you call the write method. See: http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/net/Socket.html
精彩评论