Flex force socket to flush

和自甴很熟 提交于 2019-12-11 19:32:08

问题


How can I force the socket to be flushed before next data to be send?

Example code:

public function socketSend(data:String):void
{
    socket.writeUTFBytes(data);
    socket.flush();
}

This works basically fine. But sometimes, it doesn't flush the socket, but combine current information with next information and send together. This is what I don't want because it breaks my application communication.

For example, if I call socketSend('command1') and then call socketSend('command2') I am hoping it will send the command1 first then later command2. But sometimes it sends both together, making the send string become command1command2. This breaks the application communication.

How can I force it to flush before putting in next set of information? How can I check whether the information is flushed from the socket?

Thank you.

来源:https://stackoverflow.com/questions/20772644/flex-force-socket-to-flush

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!