闪存XML套接字哽咽 [英] Flash XML socket choking

查看:191
本文介绍了闪存XML套接字哽咽的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图找出一些扭结在多点触控应用程序,我已经建立。它采用为Flosc 与发送的多点触控事件XML套接字服务器进行通信。

I'm trying to work out some kinks in a multitouch application I've built. It uses flosc to communicate with a xml socket server that sends the multitouch events.

这一切工作正常,很正常的大部分时间。

This all works fine and dandy for most of the time.

但是,如果我均值和多点触控事件淹没它的Flash无法跟上分析输入,和插座只是不断获取数据堆积起来,直到它要么赶上或整个事情崩溃。

But if I'm mean and flood it with multitouch events Flash can't keep up with parsing the input, and the socket just keeps getting data that piles up until it either catches up or the whole thing crashes.

我有没有问题丢弃输入一次有太多的*,但我无法制定一个聪明的方法来做到这一点。

I have no problem discarding input once there's too much*, but I'm having trouble devising a clever way to do it.

*的应用程序做6-10没有问题同时输入,事情开始变得毛茸茸的,一旦我要处理20 +这基本上意味着有人趴在桌子上;)

推荐答案

它在哪里窒息?首先,我将开始与做了一些分析。

Where is it choking? First I would start with doing some analysis.

简介服务器:

  • 在它多少时间考虑做XML编码?
  • 在它多少时间考虑完全写入套接字?

简介客户:

  • 这是多少时间花时间阅读从插座上的数据?
  • 在它多少时间考虑脱code中的XML?

亲自为这样的事情我会避免XML,如果你可以,和/或试图偷懒德code中的XML(这样做,当你知道你需要它...所以你可以扔掉XML块无浪费CPU周期,如果你的程序是挤破头)。

Personally for something like this I would avoid XML if you could, and/or try to lazy-decode the xml (do it when you know you need it...so you can throw away XML chunks without wasting cpu cycles if your program is getting overloaded).

我会尝试去与原始Socket类 HTTP: //www.adobe.com/livedocs/flash/9.0/main/00000318.html#wp128960 和自定义数据包格式,一个数组,其中每个索引中包含相关数据。在psudo code:

I would try to go with a raw Socket class http://www.adobe.com/livedocs/flash/9.0/main/00000318.html#wp128960 and a custom packet format, an array where each index contains relevant data. in psudocode:

messageArray = [message type, arg0, arg1, arg2...];

所以你可能有一个'鼠标移动事件'一样定义:

so you might have a 'mouse move event' defined like:

MessageConstants.MOUSE_MOVE = 0; // or whatever id you want

messageArray = [MessageConstants.MOUSE_MOVE, mouseDeltaX, mouseDeltaY];

然后使用AMF http://en.wikipedia.org/wiki/Action_Message_Format 连载该数据通过线路。

Then use AMF http://en.wikipedia.org/wiki/Action_Message_Format to serialize the data over the wire.

希望这有助于。

这篇关于闪存XML套接字哽咽的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆