ActionScript 3.0 :: Socket Data Getting Lost / Sent Out Of Order?
Jun 8, 2010
Basically what is happening is that my Flash client claims that it is calling functions that don't arrive at the server or they arrive, but the socket data is out of order and therefore is garbled.In particular, there's class I have called RPCSocket that extends the AS3 Socket class so I can serialize data structures before sending them across a socket.At one point, this RPCSocket class calls super.writeBytes and super.Flush. It is the point at which I send all data out of my client. The data is binary data in AMF3 format.[code]Can someone recommend a way for me to store without corruption, conversion, or filtering or translation of any kind *all* of the information sent across this socket? I'd like to write it to a file. I'm guessing that keep a global ByteArray var and storing the info there might work, but I'm wondering how I might get the contents of that ByteArray into a file so I can inspect it.Also, I'm wondering if I might be able to inspect what flash actually sends out on the socket? I have a sneaking suspicion that data I supply to super.writeBytes may be sent out of order or may not actually get sent across the socket. This bug I'm talking about only seems to happen under high-stress situations when I'm sending dozens of messages per second across this one socket.
View 4 Replies
Similar Posts:
Jun 8, 2010
asically what is happening is that my Flash client claims that it is calling functions that don't arrive at the server -- or they arrive, but the socket data is out of order and therefore is garbled. I've stared at the source code for hours and tried a lot of trial-and-error type stuff and added trace statements to see if I can find the problem and I'm not having any luck.
In particular, there's class I have called RPCSocket that extends the AS3 Socket class so I can serialize data structures before sending them across a socket. At one point, this RPCSocket class calls super.writeBytes and super.Flush. It is the point at which I send all data out of my client. The data is binary data in AMF3 format.
public function executeRPC(serviceName:String, methodName:String, methodParams:Array):void { if (!this.connected) { log.write('RPCSocket.executeRPC failed. ' + methodName + ' attempted on service ' + serviceName + ' while not connected', Log.HIGH); throw new Error('RPCSocket.executeRPC failed. ' + methodName + ' attempted on service ' +
[code]....
Can someone recommend a way for me to store without corruption, conversion, or filtering or translation of any kind *all* of the information sent across this socket? I'd like to write it to a file. I'm guessing that keep a global ByteArray var and storing the info there might work, but I'm wondering how I might get the contents of that ByteArray into a file so I can inspect it.
Also, I'm wondering if I might be able to inspect what flash actually sends out on the socket? I have a sneaking suspicion that data I supply to super.writeBytes may be sent out of order or may not actually get sent across the socket. This bug I'm talking about only seems to happen under high-stress situations when I'm sending dozens of messages per second across this one socket.
View 2 Replies
Jan 10, 2011
I am working on a project involving two actionscript clients and a java server. XML messages are sent from the clients to the server (and vice versa) via the XMLSocket class. The problem I am running into is that when messages are sent too quickly to one of the clients the client seems to lose track of them (it will not respond to them at all). The wierd part is when subsequent messages come in, the client will respond to old messages instead. It's as if the XML messages are getting queued up somewhere, but the signal that prompts the program to deal with them gets lost.
View 4 Replies
Jan 11, 2011
I am starting with a short introduction: I am currently working on a project, which involves a server application written in .NET (C#) and a flash gui app as client (standalone flash player 10 [code is written in Actionscript 3.0]). The server constantly sends bitmaps to the client (up to 30fps). The connection is established using binary sockets and data ist streamed to avoid socket open/close/reconnection problems.The bitmaps sent to the client are marked with begin- and end-tags. A length field was added as well, to optimise the following parsing process. The client buffers the received data up to the point where an end-tag is found. The client reassambles the bitmaps on the screen by parsing the current buffer. Parsing means looking for begin-tags and length fields and/or end-tags of pictures packages. The resulting bitmap data is copied into a byte array and will loaded into a movieclip using the flash.display.Loader class ( bytePictureLoader. loadBytes( byteArray ); ).[code]While testing, I found out that in some cases the data stream becomes currupted, i.e. data is lost and/or the transmittion is incomplete.
A good thing is that this error is reproducable.It seems that as soon as the Flash Application Window is dragged (moved on Windows Desktop) the stream lacks data. The same error occurs, if too much data is sent to the client. The results are performance problems, data loss and other strange effects. The more data is sent on the stream, the more data has to be parsed and the more data gets lost somehow. Sometimes this leads to a memory problem, because Begin- and End-Tags aren't transmitted correctly. In order to fix (counteract) that, I discard data as long as there is no Begin-tag found and the buffer is cleared when the size exceeds 1Mb.It works so far, but the application lacks performance and stability.I.e. If 20 bitmaps per second with 620x390px are sent to the client, the client only receives 16 to 17 bitmaps, if the application does nothing else.If 30 bitmaps per second with 620x390px are sent to the client, the client only receives about 20 to 21 bitmaps.I am guessing that using actuall video streams would be better, then sending one bitmap at a time in a byte stream.Is there a proper example on how to build a client app in flash to receive/parse a binary data stream?Does anyone else has recognized the lost-data problem or the interruption of streams?
View 2 Replies
Nov 4, 2011
Trying to make a grid based question answer game and load variables from a text file using for loops into an array. I wanted to reduce redundant code and use for loops to populate my arrays. The issue I am having is with my arrays being lost/destroyed outside of the loader function.
I understand that if an array is declared inside the function, naturally the array would be destroyed upon exit of the function. However I am declaring the arrays outside of the function so the arrays should remain intact after I exit the function.
BTW - I'm not having an issue with the loading of the data. The data is loading correctly. The array is simply being destroyed after the data has loaded.
//Create the arrays to hold the
//categories, questions, and answers
var categoryArray:Array = new Array();
var quesAnswArray:Array = new Array();
[Code].....
View 1 Replies
Dec 20, 2010
storing ResultEvent data from a webservice request to a variable. Each time I exit my function "getSIHandler" the global ArrayCollection variable seems to reset to null.Here's the code:
Code:
import mx.collections.ArrayCollection;
import mx.controls.Alert;
import mx.rpc.events.FaultEvent;[code]....
Each time I call getData() from a Flex component and try to access an item, I receive a #1009 null reference error.
View 0 Replies
Mar 8, 2011
Basically I have a sales presentation showing on a screen in various offices where I work. These show daily sales figures that can change as and when somebody makes a sale. I have an swf loading data from an XML file into slides and everything works great apart from if the XML file changes at the moment I need to force a refresh (manually). I'd like to make it so that if the file changes it automatically reflects in the swf. So far my research has pointed me to AS3 Socket Communication but I haven't been sucessful in finding a relevant tutorial.My code is below,
[Code]...
View 1 Replies
Oct 21, 2011
I am trying to communicate using this protocol. It works fine except when the socket has a lot of data to return. Right now I am checking if a packet ends with to determine if I have received all the packages. Problem is that sometimes a package can end with as a line break even if it is not the last package, so I can not use that.
I am using a command queue, because I want to wait for a complete response before sending the next command.
The code with unnecessary stuff removed:
class CustomSocket extends Socket
{
private var _response:String;
private var _commandQueue:Array;
[Code]....
The problem is in the function readResponse. I've googled a lot without finding anything of interest.
Is there a way to know the total amount of bytes/packets a socket will return? Or a way to detect EOF or that a package is the last?
View 2 Replies
Oct 21, 2008
I have a custom socket class designed to connect to a server and talk with it. At one point, the server uses hex data for speed, however Flash seems to not get ANY of this data. In fact, it doesn't get ANY of the data from that point to the next packet.
View 2 Replies
Jul 20, 2011
I'm trying to make a barebones, simple flash client communicate ANYTHING to a server over a regular socket. I setup the listeners:
socket = new Socket();
socket.addEventListener(Event.CLOSE, closed);
socket.addEventListener (DataEvent.DATA, onSocketData);
[code]...
And then I connect. On the server side I have a simple policy server on port 843.And then the real socket server that the flash client is connecting to.The flash client connects to the policy server and gets the policy. The flash client then connects to the actual socket server. I know this because I can both see it when snooping the network traffic and the fact that the Event.CONNECT fires off. From snooping the network traffic I can see the flash client send data TO the server when it:
socket.writeUTFBytes( "TEST CLIENT
");
From the server app I can see the data the client sent. The server then returns a little data. I can see this data going from the server to the client in the network traffic snooper. However, the client NEVER sees the data. It never fires off DataEvent.DATA or ProgressEvent.PROGRESS or ProgressEvent.SOCKET_DATA. There are no errors and the connection remains open for as long as I want it... but the flash client never seems to see the data... no matter how much I send.
Over and over I read online that the data sent to the flash socket needs to be terminated with a � zero byte. I can verify it is in the network traffic snoop.if I try to read any data from the flash app via something like readUTFBytes it always returns nothing found.
View 2 Replies
Feb 24, 2009
I'm tring to write an instant messager implementation, but i got a problem with the initial socket connection.I need to send a GET request with some parameters to a server and it will reply with a seed number message server IP.
Code: Select allvar socket:Socket = new Socket("appmsg.gadu-gadu.pl", 80);
var response:String = new String;
var request:String = new String;[code]......
why the socket isn't sending any data after the connect,i also wrote a small pop3 client and it works fine.
View 1 Replies
Oct 30, 2010
I need my flash to pull data from php dynamically. I got a php file that listens mysql for new datas to be pulled in while condition.. when data pulled I have the following ideas:
Use socket server within the same php file and send the data thru socket.. (this can be done but I do not wanna use socket yet!) have my flash file listen for posts but how can I send a POST variable from php to flash without clicking Submit button? Using Ajax and passing received-variables thru flashvars?Examples : [URL]
View 5 Replies
Feb 10, 2009
for a long time I could easily make socket connections from my swf files tom simples java servers on various ports (swfs embeded from activex, for example). I used the simple python server policy file provided at this article to open the needed tcp ports to my flash applications.
[Code]...
View 3 Replies
Mar 18, 2009
I use a socket connection to share data between flash and VB. I check the connection in VB and send a message when my flash is connected. My VB tool then sends the data continuesly (about every 40 milliseconds or slower) to flash. Works fine. Now I have to send some data back from flash to VB. I can send the data without any errors in Flash but it never arrives in VB.
View 3 Replies
Jul 20, 2011
I'm trying to make a barebones, simple flash client communicate ANYTHING to a server over a regular socket. I setup the listeners:
socket = new Socket(); socket.addEventListener(Event.CLOSE, closed); socket.addEventListener (DataEvent.DATA, onSocketData); socket.addEventListener(Event.CONNECT, connected); socket.addEventListener(
[code].....
View 1 Replies
Sep 8, 2011
If you write a simple object to a socket:
var o:Object = new Object();
o.type = e.type;
o.params = e.params;
_socket.writeObject(o);
_socket.flush();
Then on the client do you simply use:
private function onData(e:ProgressEvent):void
{
var o:Object = _clientSocket.readObject();
}
Or do you have to implement some way of checking all of the data has been received recieved before calling .readObject()
View 4 Replies
Dec 18, 2011
Use on server node.js and module Socket.IO.Data is sent as follows:
var tests = [555, 777];
client.send("Test string"); //first message
client.send({tests:tests}); //second message
[code].....
View 2 Replies
May 26, 2010
I am attempting to use an online Flash file to communicate and pass data to a device linked to a client machine.I have got the Flash to work using sockets and when run from the same machine as the device it works fine.However, the flash file needs to be online and I need a way to allow the data to be passed. At the moment it won't connect to the socket on the client machine (I just get a connection failed message after about 10 secs) and I believe that this has to do with the security settings.
I am looking into Cross Domain Policy files as a way of securing the connection, but all of the information present suggests that these are only applicable to server machines. Can I put a Cross Domain policy file on the client machine that would allow the online flash to access one of it's sockets or will a CDP file on the server hosting the flash file be able to allow access to a client machines sockets?
View 1 Replies
Jul 30, 2011
Is there some built-in limit to the rate at which flash.net.Socket can transfer data? When downloading from a server on localhost, I get a speed of about 5.8 MB/s consistently, while downloading directly from the server (outside of Flash Player) I can over 100 MB/s. Also, if I start two or more concurrent downloads, they all (individually) go at about the same 5.8 MB/s. The CPU use is under 100%. This program demonstrates the phenomenon. Running with NUM_DOWNLOADS = 1, I get
[Code]...
View 1 Replies
Oct 26, 2011
I'm sending through a socket from java to flex client some data and the flex side can't seem to handle it right. In the java i'm looping over 8 objects and for each object I create a long string 1:lsls:2:3:justexample then the java does writeToSocket("1:lsls:2:3:justexample") for every iteration of the loop. But in the client side, it seems that only 2 out of the 8 arrived. what can be the problem?
View 1 Replies
Dec 31, 2011
I'm having a problem to receive data from socket.io to Flash (actionscript).
I've tried:
Server (nodejs) socket.io :
var io = require('socket.io').listen(9000);
setInterval(function() {
[Code]....
Flash connects succesful to the server and trace "Connected to flash" but it cannot receive data.
View 2 Replies
Jul 13, 2010
We are in the middle to evaluate the technology choice to re-design an operator console application. The operator console as a hosted contact center has the abilities to queue the inactive calls, and hold, answer, transfer the active calls.
The legacy operator console used Java Swing. We want to use the latest RIA technology (Flex/Silverlight) to retire the legacy one. But the question is Flex/Silverlight can implement the functions like hold, transfer the calls? Based on my experiences, Flex can listen Java socket to receive XML data? Does it work well to receive voice data?
View 2 Replies
May 19, 2011
i want to know how to send data using the AMF format from my flex AIR project to a socket written in Java. I am getting CorruptedStreamException when sending data using writeUTFBytes() methods. Has anyone experienced similar problems? Also can AMF be used only if i am using LCDS only?
private SimpleServer(int port)
{
System.out.println(">> Starting SimpleServer on port " + port);
[code].....
View 2 Replies
May 19, 2011
Ok, basically my Flex app will open up a socket and listen on it. My java program will write some string to this port.
My AS3 code is
private function onRecvClick():void
{
var host:String = "localhost";
[Code]....
While trying to write to the socket, i am getting this java.net.ConnectException: Connection refused: connect. Funny thing is that the socket in Flex doesn't seem to dispatch any events, is it normal for that to happen?
View 1 Replies
Aug 17, 2011
I have s:list component in my MXML and a different actionsscript file which does the socket connection to the server.Everytime a user is connecting to the server I'm sending to all clients the updated users in the server by sending strings of ports (port for each user).Now, when the data gets to the client (to the action script file SocketData function), I want it to be added as an item to the s:List in the MXML file.
View 2 Replies
Feb 1, 2012
I'm using a .swf to connect to a socket and stream data as fast as possible for 60 seconds to measure connectivity speed.In other words a speed test.In the past say month or two, I've found Macintosh systems 10.5 and higher experience a significant slow down, In testing I see my socket connect and reach about 2.5Mbps - 3.5Mbps and literally stick as though the .swf was throttling the connection.
This 'problem' is random and appears to come and go. I've tested this in Chrome,Firefox and Safari with all the same results.Using the exact same test on any Windows or Linux OS works totally fine.Admittedly I'm an ActionScript novice however the code I'm using is below and has worked for some time up until recently.
ActionScript Code:
var s:Socket;
var Tbytes:Number = 0;
function connectToSocket():void{
[code]....
View 0 Replies
Nov 19, 2011
When I send number (int)52 s.Send(BitConverter.GetBytes((int)872415232));, flash show me trace(socket.readInt()); 872415232 If i send 872415232, flash show 52.Why? And how it fix?
View 1 Replies
Mar 28, 2009
I'm sending some data through an instance of URLVariables. I define it in a loop but basically it goes like this:
Name="blah";
E-Mail="blah@blah.com";
Phone="1223";
[code].....
View 7 Replies
Jul 7, 2006
It seems there are lots of topics close to this, but none with answers. I have attempted to complete the Dinner Menu sample example in Flash 8. I finally got ti to work but the columns do not match the order of the items in the XML document. I cannot find an answer to this problem anywhere on the internet so far.
View 3 Replies
Jun 7, 2011
I have a data grid and there's a method attached to clicking on any item in a row of the grid.Now, some of the items in the table row are also buttons. Each of these are associated with a different action.We only want one of these actions to be performed.[code]we have currently a member variable to track which selection was made and to ignore the the contents of the other method (the else portion of the method resets this value).Now, if the methods just happen to execute in a different order (or at the same time), the behavior will be unpredictable.Is the member variable flag the way to do this (it smells so bad)?
View 1 Replies