XML Sockets, at a loss :/

Hi guys. I’ve benn trying to get a simple socket server test to work for days now and it seems I’m not getting very far.

Basically I just want to send some data from flash to the php script and have it echo it out, or anything at all like that :frowning:

I’ve been working from this tutorial kirupa.com - PHP 5 Sockets with Flash 8, Page 1

I have this basic flash class which just sends a string to the server:

package{
    
    import flash.net.XMLSocket
    import flash.display.MovieClip
    import flash.events.*
    
    public class base extends MovieClip{
        
        
        public var socket:XMLSocket;
        function base(){
            
            var socket = new XMLSocket();
            
            socket.addEventListener(Event.CONNECT,connects);
            socket.addEventListener(Event.CLOSE,closes);
            socket.addEventListener(DataEvent.DATA,getsData);
            socket.addEventListener(IOErrorEvent.IO_ERROR, errorsOut);

             
            socket.connect("website.com", 9980);
             
            socket.send("hi");
        }
        
        function connects(success){
            if(success)
            trace("connected");
            else
            trace("connection failed");
        }
        
        function closes(e){
            trace("connection dropped");
        }
        
        function getsData(e){
            trace("message:"+e);
        }
        
        function errorsOut(e){
            trace("error:"+e);
        }
    }
}

The server side php is the attached script (pretty much this kirupa.com - PHP 5 Sockets with Flash 8, Page 3)

So I keep the php running on my server then run the as class, what happens is after a while (presumably the 15 second script limit in as) I get this error:

Error #2044: Unhandled securityError:. text=Error #2048: Security sandbox violation: …/networking.swf cannot load data from website.com:9980.
at base()

Any ideas what’s going wrong here? Am I just going about this completely wrong? I’m quite lost and not sure how to debug this…

Any help at all would be greatly apreciated guys :slight_smile: Thanks for your time.