Error #2031 refers to Socket error , which might be due to the port 8080 conflict in which case you have to set another port for it. and error 2048 is sandbox violation which is like it cant access the data of that particular folder as it is not Trusted . So can you please post the code so that i can compile it and run the swf on My HTC hero.
Code is really standar Socket start connection code.
Jusdt have a flash file and add a button named connect, a textfield called output and 2 more text inputs for the ip and port. The rest is in this snippet:
public class fc extends Sprite
private var newFormat:TextFormat = new TextFormat();
private var chatSocketConnection:Socket = new Socket();
public function fc()
newFormat.font = "Arial";
newFormat.bold = true;
newFormat.size = 30;
newFormat.color = "0xCC0000";
private function onClick(event:MouseEvent):void
output.appendText("Error" + e + "\n");
private function connectHandler(event:Event):void
output.appendText("Connected" + "\n");
private function securityErrorHandler(e:SecurityErrorEvent):void
output.appendText("SecurityError " + e.text + "\n");
private function errorHandler(e:IOErrorEvent):void
output.appendText("IOerror " + e.text + "\n");
private function closeHandler(event:Event):void
output.appendText("Socket closed" + "\n");
private function socketDataHandler(event:ProgressEvent):void
output.appendText("Got Socket Data Data" + "\n");
private function ioErrorHandler(event:IOErrorEvent):void
output.appendText("Socket IOError: " + event.text + "\n");
I forgot about this it was not suppose to work in the first place, but the the phone which had an experimental PROM, and the guy who was upgrading the phone kindly forgot to mention the expoerimental part. So I'm marking this as solved.
Hi there Claudiu,
I've been having some problems with connecting to sockets via Actionscript on an Android phone.
What I have is a simple Android app wrapper over a browser. Then this browser embeds the swf, which I am using to send out socket commands. I want to send out socket commands to the Android app itself so that it can do things. So I am connecting to "localhost". Everything works as expected when I am in the Flash IDE.
However when I try make a socket connection I get the #2048 security error. I suspect it's got something to do with security policies and cross-domain xmls needing to be imported in but I'm not sure how to go about this.
I wanted to ask if you had any success. You said that you're marking this as solved. Is that because you had the ActionScript connecting to socket on Android is no errors, or is it solved because it's not possible to send socket commands in an Android device?
Any help would be greatly appreciated.
Thanks in advance.
Well I had the crossdomain in place I tripplec checked that. My case was that I
had no idea that the phone was messed with, so it showed me a FP 10 but it was
some experimental upgrade made to the phone. Funny thing URLLoader requests went
through just fine. I ran the same code on an HTC Desire and I had no issue with
that... We were sniffing packets over the network it seemed that the call for
the crossdomain got to the server but the reply never got back. I read something
about latency and somehow the response being delayed for moreover that a sec for
some phones but I doubt that was the issue here. The phone had its limitations I
guess, after downgrading it back to original settings we were not able to do
much on it anyway. Sorry I can't help more with this... I guess sockets are only
working for Desire and not for Hero.