ActionScript 2.0 :: XMLSocket.onData And UTF-8 Zero Bytes?
Aug 6, 2007
I'm currently playing around a bit with Java and Flash's XMLSocket to get them to talk together. The Flash documentation doesn't mention this anywhere, so I assumed that Flash's XMLSocket sends out its data encoded in UTF-8 just like XML.load expects its XML files to be UTF-8 encoded (and won't take anything else even if you tell it to!). This seems to be correct, because I've had Java send the string back as UTF-8 and Flash displayed it fine.However, there is a slight complication. XMLSocket's EOF marker for both input and output is a single zero byte, but certain high-codepoint Unicode characters get encoded in UTF-8 containing several zero bytes. When I have Java send back a byte sequence containing one of these multi-bytes characters, XMLSocket's onData seems to fire for the zero bytes that are part of the UTF-8 encoded string, as well as the zero byte EOF markerCode:61 62 63 00My Java server receives this sequence successfully and echoes it back to Flash identically. So Flash then receives:Code:61 62 63 00XMLSocket reads this, fires onData when it hits the last zero byte, and all is fine.
View 1 Replies
Similar Posts:
Jul 4, 2005
how can I get the bytes loaded and bytes total, from a JPG i'm loading using loadMovie? the point it's making a loadbar
Code:
image.loadMovie("pic.jpg");
View 2 Replies
Jul 13, 2009
What I'm trying to do is get the total bytes of all the files I want to load and display the percentage loaded of total bytes and bytes loaded of all the files. Its a slideshow so i want all the files loaded and then it will play. I've looked at bulk-loader but it wasn't what I needed. The image are loaded from an xml file. I think I would need to create an Array and then find out the total bytes but I don't know how to reference the loader in the progress.
[Code]....
View 2 Replies
Nov 26, 2005
I don't really know what's wrong with this. The Server connection works just fine, but the databuffer always appears to be empty if I try to access it (either directly or with a get-function).
If I trace databuffer in the onSocketData-function it returns the right value (that is a string from the server, like "|25| " terminated by the NULL-Character).
[Code]...
View 3 Replies
Feb 14, 2006
I use this code and try to get data from simply txt file. I explored with onData method.
AS:
Code:
var myLV:LoadVars = new LoadVars ();
myLV.onData = function (scr:String)
{
[Code]....
View 5 Replies
Aug 29, 2009
i am writing a flash app that receives its data over a XMLSocket. On the testmachine that worked really fine, but now the data will be ssl secured. Is there any XMLSSLSocket or something similar available? If not XMLSocket a normal SSLSocket would be a great help as well.
View 2 Replies
Aug 17, 2011
I have a perl socket on my apache server that correctly takes input from sockets and sends it back out to every socket connected to the perl socket. I have tested the perl socket, and it works correctly.
When I launch the Flash in the IDE, as a flash program, it functions correctly with the perl socket.
However, when I try to launch the Flash in a Browser on my apache server, it tells me it is unable to connect to the server.However, I am seeing from feedback from my perl socket, the flash connects for about a half of a second, and thats it.
What could be the problem, do I have to include code in the flash to allow XMLSockets to connect in a browser as well? Is there certain things I need to do with my apache server to make it work?
Also if I 'Preview as HTML' from Adobe Flash CS4, it does not connect.
View 3 Replies
Nov 22, 2011
I'm trying to make a socket client in FlashAS3 for my socket server written in nodejs. I also have a mobile app client that communicates with it.
In AS3 I wrote some test code that works perfectly when I publish and run Windows EXE file but when publishing to SWF and opening in browsers it does not connect to server. Even all that "imports" do not help. The Code:
[Code]...
View 2 Replies
May 3, 2005
On this page it says "The XMLSocket.connect method can connect only to TCP port numbers greater than or equal to 1024"This makes it hard to get a chatserver to work through a firewall.BUT I recently discovered on this page that you can set up "policies" for your flash movie that allow it to run on port 80.
View 1 Replies
Aug 6, 2009
Im looking for a solution for the Error #2048 from Flash. I have a server program developed in Java using the class xSocket and it works fine. It manage the clients from Flash. Well, once i installed the server app in my domain "97.225.158.110" and running the client developed in Flash from my PC within Flash environment, it connects to the server with no problem. But, if i upload the flash to the domain and load it in a web explorer, it doesnt work. Well, i have been seeing many web pages mentioning the policy file and i will show you how i have done it: In the the Java App i have a event handler for incomming data where i idetify the incomming string:
Code:
if(data.equalsIgnoreCase("<policy-file-request/>")) {
Main.Log.append("Enviando archivo Politica Seguridad");
nbc.write("<cross-domain-policy><allow-access-from domain="*" to-ports="8090"/></cross-domain-policy>�");[code].............
Well, the java server app receive the string policy request and it should answer with the quoted file but the Flash never receive it and in a minute the Error 2048 appear.
View 2 Replies
Aug 16, 2009
I am sure that I am missing something simple but I am doing an overhaul of a flash chat application that I wrote a few years back.I have everything humming along in Actionscript 3 and it works well when I test the .swf in Flash CS3 Pro but when I publish it and view it in the browser, I get no joy.I can see the flash plug-in retrieving the crossdomain.xml in my web server's root directory but in the browser, the XMLSocket Object fails to connect I installed flashpolicy server that is responding on port 843, but again, through the browser, the XMLSocket Object fails to connect.I have tried both Firefox and Safari browsers with the same result.I have swapped out the XMLSocket Object for the Socket Object and I am able to connect to my socket server, from within Flash CS3, but not from a browser.
View 3 Replies
Nov 10, 2009
I have a XMLSocket and I call send twice in the same function. The first send 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?
View 1 Replies
Feb 7, 2010
I have a server that I have written in Python and I'm trying to connect to it via Flash's XMLSocket. I know for sure that this server is working properly as I have used it successfully with multiple non-Flash client applications. For right now, I just want to connect to the remote server with an SWF residing on my local disk. From what I understand, this means that I do not need a security policy file since the SWF is not in another domain. I have also confirmed that the security sandbox property of the file is set to local-trusted, so the SWF should be able to connect to servers and retrieve data from them. Here's the important code from the AS file:
[Code]...
View 3 Replies
May 18, 2011
In what situations should i use Socket class or XMLSocket when trying to connect from Flex to a Java Server that is going to listen to a port?
View 1 Replies
May 24, 2011
While using Socket, i am able to read the data as
while (socket.bytesAvailable)
{
textArea.text += socket.readUTFBytes(socket.bytesAvailable);
}
How can i read the data while using a XMLSocket? Is it enough to use xmlSocket.toString() ?
View 2 Replies
Jan 19, 2009
i am using this code to connect to socket
Code:
function configureListeners(dispatcher:IEventDispatcher):void {
dispatcher.addEventListener(DataEvent.DATA, dataHandler);
dispatcher.addEventListener(Event.CONNECT, connectHandler);
dispatcher.addEventListener(Event.CLOSE, closeHandler);
dispatcher.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
[Code]...
View 2 Replies
Aug 4, 2009
I'm writing a flash chat program using XMLSocket.It's connecting and sending data just fine. The server is sending the data back just fine (I checked the packets on Ethereal), but Flash is just not receiving any data.[code]The server is a Java server written with the NIO classes.
View 2 Replies
Jun 18, 2003
I am writing an XMLSocket Flash program and basically on startup, i call a funcion initialize, which connects the socket to the server and sends a message. Now I need to to wait for several startup messages from the server before I can continue. I need this to time out if they are not received.
View 2 Replies
Mar 24, 2009
Basically, I have an actionscript file as follows:
Code:
package {
import flash.display.Sprite;
import flash.events.*;
import flash.net.XMLSocket;
[code]....
And ALL I'm trying to do is return the information from the dataHandler to my main flash application.So just to emphasise I don't want it to trace the output (which it does OK), I want to return it as a String to my main application.
View 3 Replies
Apr 22, 2009
I have an actionscript file called[code]....
View 5 Replies
Jun 4, 2009
I have done everything in my knowledge and everything i can find in Google to successfully connect to a simple php socket server that I create on my friends server.I can connect to the server successfully as long as the flash file is not on the server.If I "run" the fla on my computer, it works perfectly.I also sent the SWF to my friend who owns the server and he was able to get it to work running from his computer.He had a security thing at first but was able to change his settings to get it to work.I have tried uploading the swf to one of my servers and run it but it did not work either.As found in google, I added a crossdomain.xml file to the server and allowed any possible path that could be used. Nothing seems to work unless the flash is running straight off of the users computer.I have also tried the loadPolicyFile and it did not help either.
View 4 Replies
Aug 24, 2009
I'm trying to make a multi-player game. Should I use SharedObject, which I find REALLY simple, or XMLSocket to make the users communicate with the server? Which will be the faster option?
View 4 Replies
Dec 16, 2009
Code:
// action script
var socket:XMLSocket = new XMLSocket("127.0.0.1",8888);
socket.addEventListener(Event.CONNECT, connected);
socket.addEventListener(DataEvent.DATA, transData);
[Code]....
this won't send the string "this string won't be sent" to the client(flash).
View 1 Replies
Aug 21, 2004
some other buds are creating a game where we need to have multiple players in 'real time'. I have tested the solution of using a database/text file to handle the player positions, but it used huge amounts of CPU w/ only 2 players. So I wrote a socket server in PHP, and now I need help creating the AS part of it .I already wrote a bunch of accessors, I would like you to tell me if this is the best way to do it, as I am a total AS n00b.
Code:
/* Handle the receiving of player positions */
XMLSocket.prototype.onData = function (PlayerList)[code]...........
View 2 Replies
Jan 5, 2010
I'm trying to stabelish a connection using XMLSocket:
var socket = new XMLSocket();
socket.connect("dyn.obi-graphics.com", 9999);
socket.onConnect = function(success)
[code].....
View 1 Replies
Oct 29, 2009
am getting now really crazy over this.I wrote a shockwave application that connects to a server (this one I wrote in PHP) via XMLSockets. My problem now is that exactly after 3 seconds the client disconnects automatically from the server.Maybe some of you could review my code to give me a hint where the problem is located - note that I use ExternalInterface and call the functions with JavaScript.
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
creationComplete="setup();">
[code]......
View 3 Replies
Jul 30, 2009
I have a Flash client that I want to connect to a server. Both are using localhost and port 50000 so there shouldn't be any cross-domain problems. I also set Access Network Only in the publishing settings. When I call the XMLSocket connect, the server seems to get a new connection. But, the XMLSocket.onConnect callback is not called with success=true.[code]...
View 2 Replies
Mar 2, 2010
I have a project which tries to send an XML using XMLSocket to a server listening to it on the other side.The application file is:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:Script>
<![CDATA[
[code].....
I have to open and close the socket on each request, but even trying not to do that for the sake of testing didn't help.
View 1 Replies
Mar 12, 2010
We're trying to create an app for OpenPeak. The Flash app will act as a client to a Java server on another computer on another domain.The Flash app client connects via XMLSocket. The Java Server uses ServerSocket to receive a request and send back a message.In order to trust the server, the Flash client needs a socket master policy file to tell it that the server comes from a trustworthy domain. According to an article on Adobe, when a connection has succeeded, the Flash client automatically requests the cross-domain policy or socket master policy file on port 843.Still, even when we implement it according to the tutorials and recommendations we have read, the Flash client continues to throw the following security error:[code]We've tried logging the policy file request during testing to see if there was any call made to port 843. There was not.Interestingly, even without a policy file, the Flash client still manages to send the first data message to the server successfully. It's just when the server tries to send back a reply that the entire thing hangs for about 10 seconds before the security error above is displayed.
View 1 Replies
Aug 27, 2010
I believe my flash client is losing some packets the server sends, because some packets get joined together hence I believe it drops them.Here is my packetHandler in flash
private var xmlsock:XMLSocket;
this.xmlsock = new XMLSocket();
xmlsock.connect("127.0.0.1", 1234);[code].......
A possible packet I sniffed sent by the server was.
u:105.w. aka (75 3A 31 30 35 00 77 00)
so the waiting packet never came in.
View 2 Replies