Flex: Error # 2048 al conectarse a un WebSocket

I've implemented a simple Flex application that tries to connect to a server via the WebSocket protocol. Running the app in the Flash Builder 4.6 debugger everything works fine. So I installed the application on my server and now I get Error #2048 after a while. #2048 seems to be an error concerning security.

The server provides this crossdomain.xml:


<?xml version="1.0" encoding="UTF-8" ?>
  <cross-domain-policy xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.adobe.com/xml/schemas/PolicyFileSocket.xsd">
  <allow-access-from domain="*" to-ports="*"  />
  <site-control permitted-cross-domain-policies="master-only" />

Edit: It's provided by calling


I can see in the web server logs that the client loads it.

Estoy usando AS3WebSocket as the WebSocket implementation for Flex.

This is how I set up the WebSocket object:

websocket = new WebSocket(url, "*", 'dummy', 5000);
// adding several event handler ...

The browser connects to the server with


La url parameter holds


Why does it work locally with the Flash Builder and not on my server? What am I missing?

preguntado el 31 de enero de 12 a las 16:01

What port is crossdomain being dished out on. -

The very first line executed in the Flex app is Security.loadPolicyFile('httpaddressofmyserver:8081/crossdomain.xml');. And it's loaded from the app. That much I can see in the logs of my web server. -

please refer to my other post here stackoverflow.com/questions/7634266/… -

Hi, I think I tried everything you advised in your post. I've tried your crossdomain.xml. Same error. Why does this happen when I deliver the app from a server? It works locally even though I connect to the same server via WebSocket. -

http:////myserver:8081/crossdomain.xml is not in the same domain as ws://myserver:8081/data for that matter where is the .com -

3 Respuestas

<allow-access-from domain="*" to-ports="*"  />

leave out the "permitted-cross-domain-policies="none" bit.

Try that for now. make it more secure when everything works.

Respondido 01 Feb 12, 05:02

I've changed the crossdomain.xml but I still get error #2048. It loads the file. That's for sure. Is there any way to find out exactly what causes the security error? - Jan Deinhard

Please check Firewall Security [internal and external access to port] this can be one of the cause to your problem.

Please check below link:- http://flexhappycoding.blogspot.in

Respondido 03 Feb 12, 11:02

Thanks for the tipp but the port is open. I can connect to the port via HTTP from a browser. Just the Socket connection can't connect and it seems it does not try because of security issues specific to Flex/Flash. - Jan Deinhard

I got this working. I somehow missed the information that I needed a special policy server running for socket policies on port 843 providing the policy file via TCP.

Respondido el 25 de junio de 12 a las 15:06

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.