Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Molix · Apr 29, 2011 at 03:59 AM · crossdomainsecuritypolicy

Security Policy works with WWW but not with PrefetchSocketPolicy on web port?

I cannot seem to get the security policy to work to allow me to open a connection to SFS.

I put crossdomain.xml into my web root, and I try to prefetch it on port 80, but it basically locks up for a long time (even the timeout doesn't seem to work--it is in milliseconds, right?), before returning false.

However, if I just try to open a WWW connection, it automatically grabs the policy, and continues happily. This leads me to believe I've got it set up correctly.

Here's a sample:

WWW www = new WWW( "http://" + serverIP + "/robots.txt" ); // can see in web server log the request for // crossdomain.xml, then robots.txt

if( !Security.PrefetchSocketPolicy( serverIP, 80, 500 ) ) { // this always fails, and it takes a long time to fail // (more than 500ms), and there are no requests in the web server logs Debug.LogError( "Failed to retrieve security policy" ); }

So why would it work for the one, but not the other? Why would there be no access request? Or how can I put a listener on port 843 on a Linux box so I don't need to use the web server?

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by cncguy · Apr 29, 2011 at 04:32 AM

My understanding is that for connections to sockets you must have a socketPolicyServer on your server listening for connections. If it listens on port 843 then you don't need to use PrefetchSocketPolicy as when you try to make a socket connection unity automatically checks for a policy returned from port 843 of the server you are trying to connect to.

Unity ships with a default socketPolicyServer written in C#. Unfortunately that won't help you with linux (actually I am looking for a linux one too) although linux must have a command ine tool to listen on a port and return an xml file on a received connection. I have used unity supplied socket policy server successfully on a windows server so can confirm that this is what you need. The xml policy file on the root of your server is not checked when a socket connection is requested. That is for HTTP requests and the like.

see:

http://unity3d.com/support/documentation/Manual/Security%20Sandbox.html

Comment
Add comment · Show 3 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Molix · Apr 29, 2011 at 01:57 PM 0
Share

I read all the docs, and every post I could find, before asking here; it just was not very clear to me (and now it seems that all the other posts may have confused matters more). But the short answer is "they're not the same thing so you need the Linux server", and I thank you for that.

avatar image kungfooman · Jun 10, 2014 at 02:09 AM 0
Share

PrefetchSocketPolicy() still doesn't do ANYTHING but failing. I've set up a crossdomain-server on port 843 which is delivering the privacy rules.

Also neiter TcpClient nor UdpClient works. I see the privacy-request in node.js though, but Unity keeps complaining with a freaking vague message:

"SecurityException: Unable to connect, as no valid crossdomain policy was found"

 var net = require("net");


 net.createServer(
     function(socket)
     {
         console.log("got request...");
         socket.write("<?xml version=\"1.0\"?>\n");
         socket.write("<cross-domain-policy>\n");
         socket.write("<allow-access-from domain=\"*\" to-ports=\"*\"/>\n");
         socket.write("</cross-domain-policy>\n");
         socket.end();
     }
 ).listen(843);


Edit: I realized that my setup works, but only as native build on Windows. Neither in Debug IDE nor Web Player. :(

I just consider buying Unity 5 because of the ability to make a multiplayer game for my Website...

avatar image clever · Jun 09, 2015 at 03:09 AM 0
Share

I got Unity 5 and having a similar problem. In my case the game does a WWW call to a php script to receive the server IP, then connects to the server using sockets (Network class). I'm still getting these very long freezes, sometimes are shorter than others (which is weird)... anyways if you come across a reason for this issue please post

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

2 People are following this question.

avatar image avatar image

Related Questions

How to serve security policy on linux system? 2 Answers

Why is Unity trying to get a crossdomain policy, even when trying to access a server on the same domain? 2 Answers

Error with Facebook's crossdomain file? 0 Answers

No valid crossdomain policy available to allow access 1 Answer

crossdomain issue 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges