all groups > flash data integration > december 2004 >
You're in the

flash data integration

group:

xmlSocket:connect works locally but not on web


Re: xmlSocket:connect works locally but not on web James Fee
12/14/2004 9:07:42 AM
flash data integration:
Flash is looking for a crossdomain.xml file on the socketserver.mydomain.com
port 80 served as a web request (it actually does a get looking for
socketserver.mydomain.com/crossdomain.xml)

--
Jim Fee
Viking Electronic Services
jfee (at) vikinges (dot) com


[quoted text, click to view]

xmlSocket:connect works locally but not on web foutuguy
12/14/2004 9:48:40 AM
Here is what I am trying to do:
I have a XML socket server where I want to connect with a simple flash client
(one frame) on port 50000. When I connect to the server, I display the data
received. I put also the line system.security.loadPolicyFile("url of the policy
file"); Nothing else.

It works fine when i execute the swf locally but when i upload it on the
website, it can't connect to the xml socket server.
the policy file is accessible from any browser, I tried it.

Anybody has an idea on where could be the problem? Is there a way to debug
that? I did not see any variable feedback for loadPolicyFile. How to check that
the policy file has been correctly loaded?

The code looks like this :
// let's say the socket server is at socketserver.mydomain.com on port 50000
// my flash file is at http://subdomain.anotherdomain.com/folder/file.swf
// the policy file'url is http://socketserver.mydomain.com/policy.xml and
looks like this :
// <cross-domain-policy>
// <allow-access-from domain="http://subdomain.anotherdomain.com"
to-ports="50000" />
// </cross-domain-policy>

// load the security policy file
System.security.loadPolicyFile("http://socketserver.mydomain.com/policy.xml") ;

//data reception
var socket:XMLSocket = new XMLSocket();
socket.onData = function(data) {
msg +=data;
}

//connect to the socket server
socket.connect("socketserver.mydomain.com", 50000);

// chek for xml socket server connection or failure
socket.onConnect = function (success) {
if (success) {
connection_txt = "connected";
} else {
connection_txt = "connectionFailed";
}
}


Thanks a lot for any help

Pierrot:confused;
Re: xmlSocket:connect works locally but not on web Matthew David
12/14/2004 4:16:50 PM
Example would be:

<?xml version="1.0"?>
<!-- http://www.foo.com/crossdomain.xml -->
<cross-domain-policy>
<allow-access-from domain="www.friendOfFoo.com" />
<allow-access-from domain="*.foo.com" />
<allow-access-from domain="105.216.0.40" />
</cross-domain-policy>


save the file as crossdomain.xml in the root of your site.


--
Matthew David
PH: 920.475.2972
FAX: 775.239.8171
mdavid@matthewdavid.ws

New Books at http://www.cafepress.com/matthewdavid on Flash Rich Internet
Applications


[quoted text, click to view]
System.security.loadPolicyFile("http://socketserver.mydomain.com/policy.xml"
)
[quoted text, click to view]

Re: xmlSocket:connect works locally but not on web James Fee
12/15/2004 7:49:43 AM
Also they get served up as a web request. I have a situation where the web
site that serves my flash movie is on one domain and the server that flash
connects to is on another. The one that serves up the site obviously runs
off a web server, but the other one that flash connects to does not have a
web server on it. I had to write a web proxy that would take port 80
traffic and redirect it internally to a site that served up my
crossdomain.xml, just so my flash would work. Pain in the ...

--
Jim Fee
Viking Electronic Services
jfee (at) vikinges (dot) com


[quoted text, click to view]

AddThis Social Bookmark Button