Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 deanpackard · Aug 08, 2018 at 11:01 PM · databasesql

WWW is returning Cannot connect to Destination host, when I know the host is reachable

I recently moved a database for a game I'm working on from my local machine to an online database hosted by GoDaddy. The php files and the database itself has all been moved. About half of the php files are run properly and work great, but a few of them keep returning network errors and I'm not sure why. I've checked to make sure I'm entering the URLS properly and can't find anything like that. Maybe I just need another set of eyes to see mistakes I'm not noticing. Here is the declaration of the URL

  public string userTableUrl = "http://assassintag.com/getUserData.php";

Here is where the URL is being utilized

 //Purpose: put the game in the users list of games they are participating in
 //Parameters: none
 //Returns: an IEnumerator
 IEnumerator addGameToUser()
 {
     WWWForm userForm = new WWWForm();

     userForm.AddField("userPost", PlayerPrefs.GetString("user"));
     userForm.AddField("gamePost", gameName.text);
     userForm.AddField("adminPost", "true");
     using (UnityWebRequest www = UnityWebRequest.Post(addGameUrl, userForm))
     {
         www.chunkedTransfer = false;
         yield return www.SendWebRequest();

         if (www.isNetworkError)
         {
             Debug.Log(www.error);
         }
         else
         {
             Debug.Log("POST successful!");
         }
     }
 }

and finally, here is a picture of the files on the file manager alt text

files.png (72.9 kB)
Comment
Add comment · Show 3
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 Cynikal ♦ · Aug 09, 2018 at 12:13 AM 0
Share

This issue sounds like DNS propogation. (Takes up to 48 hours for the DNS to propogate to the new server).

avatar image deanpackard Cynikal ♦ · Aug 09, 2018 at 12:30 AM 0
Share

could that be the issue even if other files are working?

avatar image Cynikal ♦ deanpackard · Aug 09, 2018 at 02:08 AM 0
Share

Honestly, yes.

Easiest way to fix it is to clear your DNS cache via your router and your PC both.

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by Bunny83 · Aug 09, 2018 at 07:27 AM

Well it's difficult to say what might be wrong here. Keep in mind that most servers are Unix based and do have case sensitive files names unlike windows. That's a common issue when moving to a unix / linux server that the capitalisation of file or folder names could cause issues.


Apart from that you should check if your server actually allows "http" connections. Maybe you need to use "https"?


Next is you don't cover all errors you could get. isNetworkError covers only network errors but no http errors. You usually just read the "error" property and see if it's null or not. The property literally does this internally:

 public string error
 {
     get
     {
         if (!this.isNetworkError && !this.isHttpError)
             return null;
         else
             return UnityWebRequest.GetWebErrorString(this.GetError());
     }
 }

So you usually just do something like this:

 yield return www.SendWebRequest();
 string error = www.error;
 if (error != null)
 {
     Debug.Log(error);
 }
 else
 {
     Debug.Log("POST successful!");
 }

The DNS resolution shouldn't really be any issue if other files are working. The DNS lookup is only responsible for resolving the "host" part of your URL with an actual IP address to connect to. If you do a ping yourServerDomain.com in the console it should resolve the IP of your server. If that works the DNS is working fine.


Finally what may also cause issues are some sort of bot protection of certain rented servers. Some servers (which are only meant for websites) often apply a redirect to some sort of landing page with a piece of javascript code to verify this page is shown in a browser. Automatic redirects are usually silently handled by Unity's webrequest. However you can never know what else may go wrong.


I strongly recommend to install WireShark and record your request attempt. Keep in mind when using wireshark you either need to use a good filter (which is often difficult) or shut down as many applications that could cause network traffic (this is usually the best approach). So things like skype, steam, dropbox, any kind of browser should be closed.

Wireshark is free and can be obtained from www.wireshark.org

Comment
Add comment · Show 4 · 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 Bunny83 · Aug 09, 2018 at 07:29 AM 0
Share

ps: Hopefully this is not your only ad$$anonymous$$ check:

 userForm.AddField("ad$$anonymous$$Post", "true");

^^

avatar image deanpackard Bunny83 · Aug 09, 2018 at 08:38 PM 0
Share

@Bunny83 thanks for all of the ideas, ping.time is -1, so it's unreachable. I'll play around with the url, (take away www, make it https, etc.

Also, that isn't an ad$$anonymous$$ check, that is an ad$$anonymous$$ assignment, so don't worry :)

avatar image Bunny83 deanpackard · Aug 09, 2018 at 09:32 PM 0
Share

Your comment is confusing. If you do a ping with the host name (at least on windows) it will show you the resolved IP, regardless if the ping was successful or not. If it doesn't your DNS resolution doesn't work. If that doesn't work any other tests are useless ^^. When you do a ping, make sure you only use the host name of your URL.

Show more comments
avatar image
0

Answer by deanpackard · Aug 10, 2018 at 03:36 PM

I've discovered that when my local server is on, everything defaults to that. I flushed my dns, but its not working still.

Comment
Add comment · Show 1 · 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 deanpackard · Aug 10, 2018 at 03:36 PM 0
Share

@Bunny83 thoughts?

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

93 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 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 avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

save load exp on database 2 Answers

How can i access a database in the web from unity iphone? 1 Answer

Hosted Database for Mobile Game 0 Answers

connect MSSQL in Unity,MSSQL in Unity 0 Answers

Access a MySQL database via C# ? 2 Answers


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