언어 설정

Menu
Sites
Language
HTTP/WebRequest

Hi there,

try to download some XML files from an HTTP server.

I got developed that code here inside Visual Studio 2017:

 

 public string testURLR()
        {
            try
            {

                WebRequest request = WebRequest.Create("http://www.domain.com:123/weatherdata.xml");
                request.Credentials = CredentialCache.DefaultCredentials;

                // Get the response.  
                WebResponse response = request.GetResponse();

                Stream dataStream = response.GetResponseStream();
                StreamReader reader = new StreamReader(dataStream);
                string responseFromServer = reader.ReadToEnd();
                

            reader.Close();
                response.Close();
                return responseFromServer;
              

            }
            catch (Exception e)
            {
                return e.ToString();
            }
        }

 

However, the method GetResponse throws an Exception: "System.Net.WebException: Cannot resolve host name."

My watch R805 is connect through Wifi and got proper IP, Netmask, Gateway and DNS information definitely.

Is there some special preparations on the routing?

Btw, as the server to be accessed can also addressed by a fixed IP address (So no DNS resolving required), then the error message will be "Couldn't connect to server" which tells me the application has some network access restriction (by TizenOS??)

Any idea how to overcome this? Any special access right required or configurations?

 

Thanks!

 

Responses

3 댓글
Armaan-Ul- Islam

To Access Internet from a Tizen Application, an app requires internet privilege.

From your project:

XXX.Tizen > tizen-manifest.xml > Privileges > Add > Internet

 

Please add the privilege and let know if this worked out for your scenario.

Hafner

Hi there,

thanks, yes that was actually solving the first issue.

But I immidiately run into the next one. Once the wifi is on the WebRequest works rather fine indeed.

However when I establish Internetconnection through my mobile phone (by bluetooth) connection, I cannot access Internet - evenso other apps are able to access internet.

Are there more privileges required? I thought the privilege "Internet" would cover the abstract access to internet, no matter which medium is used. Isnt this the case?

 

Thanks.

Armaan-Ul- Islam

You're welcome.

 

As far as I know, no other privilege is required.

FYI, Internet connectivity to Tizen Wearable is supplied/backed-up by Samsung 'Galaxy Wearable'/'Samsung Gear' app on Android/iOS phone. Checklist:

# Please make sure your phone is connected to Internet, you have sufficient mobile data pack/wi-fi signal strength.

# Verify that Your phone has no 'Data Saver' plan enabled, which restricts foreground/background-data usage.

# Clarify 'Galaxy Wearable''/'Samsung Gear' app has internet connectivity & background-network usage is not restricted for 'Galaxy Wearable'/'Samsung Gear' app in your mobile.