Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice
  2. Ever participated in one our Game Jams? Want pointers on your project? Our Evangelists will be available on Friday to give feedback. Come share your games with us!
    Dismiss Notice

WebException: Error: NameResolutionFailure only on Android mono builds

Discussion in 'Scripting' started by zlSimon, Nov 4, 2015.

  1. zlSimon

    zlSimon

    Joined:
    Apr 11, 2013
    Posts:
    31
    Hi,

    I have a managed unity plugin where I send out a simple GET webrequest via Https using the .Net webclient class. This works fine in the Editor or on IOS (IL2CPP) and I am getting a valid response.
    However on an Android mono build I receive followin error:

    D/dalvikvm( 4106): GC_CONCURRENT freed 524K, 23% free 9880K/12720K, paused 12ms+2ms, total 78ms
    W/mono (23070): _wapi_gethostbyname: Need to translate 0 into winsock error
    I/Unity (23070): WebException: Error: NameResolutionFailure
    I/Unity (23070): at System.Net.HttpWebRequest.EndGetResponse (IAsyncResult asyncResult) [0x00000] in <filename unknown>:0
    I/Unity (23070): at System.Net.HttpWebRequest.GetResponse () [0x00000] in <filename unknown>:0
    I/Unity (23070): at System.Net.WebClient.GetWebResponse (System.Net.WebRequest request) [0x00000] in <filename unknown>:0
    I/Unity (23070): at System.Net.WebClient.DownloadDataCore (System.Uri address, System.Object userToken) [0x00000] in <filename unknown>:0

    Anyone any ideas?
     
  2. zlSimon

    zlSimon

    Joined:
    Apr 11, 2013
    Posts:
    31
    Oh and I did forget to mention that this error does not occur when I enable the "script debuggin" checkbox for a build
     
  3. zlSimon

    zlSimon

    Joined:
    Apr 11, 2013
    Posts:
    31
    Well it works when setting the "Internet Access" checkbox to "required" in the Player settings...
     
  4. yoyo696

    yoyo696

    Joined:
    Aug 11, 2015
    Posts:
    14
    thanks so much. It works Perfectly
     
    Chastom likes this.
  5. skysepehr

    skysepehr

    Joined:
    Jun 4, 2019
    Posts:
    1
    that worked ,Thanks!
     
unityunity