• 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
Question by vexe · Mar 18, 2016 at 02:31 PM · timeserverwwwwebphp

`Recv failure: Connection was reset` In editor? (platform set to Android NOT WebPlayer)

Greetings,

I've been banging my head against the wall the past few days, just before we wanted to publish an update, our server stopped responding back to give us time in UTC. Basically I have a small PHP script in our server that just 'echos' back the time in UTC, I use WWW and pass it the URL of the script and get the time back in www.text But for some god-only-knows-what reason, the server just stopped responding never giving back the time value with the error:

 Recv failure: Connection was reset

Here's my codes:

 IEnumerator GetServerTimeRoutine(Action<DateTime> setTime)
     {
         string servicesUrl = "http://path/to/script.php";
 
         var postUrl = servicesUrl + "?action=GetServerTime";
 
         var www = new WWW(postUrl);
 
         yield return www;
 
         if (!string.IsNullOrEmpty(www.error))
         {
             setTime(DateTime.UtcNow);
             General.Utils.DebugLog("Error getting time from server. Using DateTime.UtcNow instead. " + www.error, true);
         }
         else
         {
             DateTime currentTime;
             if (!DateTime.TryParse(www.text, out currentTime))
             {
                 setTime(DateTime.UtcNow);
                 General.Utils.DebugLog("[Server] Couldn't parse server time. Using DateTime.UtcNow instead: " + www.text);
             }
             else
             {
                 setTime(currentTime);
             }
         }
     }

PHP Script:

 <?php
     if(isset($_GET['action']) == "GetServerTime"){
         date_default_timezone_set("UTC");
         echo date('Y/m/d H:i:s');
     }
 ?>

I did some research, read some people saying that I should have a 'crossdomain.xml' file in my root server folder, I did just that:

 <?xml version="1.0"?>
 <!DOCTYPE cross-domain-policy SYSTEM
 "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">
 <cross-domain-policy>
     <site-control permitted-cross-domain-policies="master-only"/>
     <allow-access-from domain="*"/>
     <allow-http-request-headers-from domain="*" headers="*"/>
 </cross-domain-policy>

But it had no effect whatsoever. Upon further investigation it seems that people who need t$$anonymous$$s file have their build option set to WebPlayer, w$$anonymous$$ch mine isn't. Mine's set to Android.

I have no idea why t$$anonymous$$s is happening, if anyone has any idea it would be deeply appreciated.

@Bunny83

Thanks.

Comment

People who like this

0 Show 1
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 vexe · Mar 18, 2016 at 03:13 PM 0
Share

It seems that if I do multiple requests, I will eventually get a response back, it's just mostly the first one that fails. No idea why.

0 Replies

· Add your reply
  • Sort: 

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

42 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Getting a Code to Run at a Specific Time of Day Even if App is Off. 1 Answer

www request ienumerator function doesn't work 0 Answers

Is it feasible to use Dropbox as a pseudoserver? 1 Answer

WWW Class behaves strangely on iOS 3 Answers

Network class vs php for authoritative actions? 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