Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Socket Server -- send cross domain policy to Flash Client  (Read 2211 times)

0 Members and 1 Guest are viewing this topic.

robochase6000

  • Newbie
  • *
  • Posts: 2
    • View Profile
Socket Server -- send cross domain policy to Flash Client
« on: February 23, 2011, 06:37:33 am »
I've got a pretty bare-bones socket server written with SFML.  I can connect and communicate with the server when using a client written with SFML.

I want to be able to communicate with the server using a client written in Flash.  So far, my Flash client is able to connect to the server, but it doesn't get any further than that because Flash is waiting for a 'cross domain policy' file (xml) from the server to validate some networking stuff.

Anyone come across this and, if so, how do you handle this?  I would imagine when a connection with the client is first established, I could try having the server send the xml file to the client.  

Here is what my xml file looks like:

Code: [Select]

<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<allow-access-from domain="*" to-ports="*" />
</cross-domain-policy>

robochase6000

  • Newbie
  • *
  • Posts: 2
    • View Profile
Socket Server -- send cross domain policy to Flash Client
« Reply #1 on: February 23, 2011, 07:15:25 pm »
I was able to solve this by compacting the cross domain policy file 'flattened' into a single string and sending it off to the Flash client when the client first establishes a connection, like so:

Code: [Select]

// client just established connection with socket server,
// send cross domain policy info
char ToSend[] = "<?xml version='1.0'?>< ... etc";// i abbreviated this, you would want the full policy file in this string.

Client.Send(ToSend, sizeof(ToSend));


Seems to work o.k.  Hopefully this post helps others out :)

 

anything