Access a Webserver from smartphone












0















I have a C# webserver running on my PC, i can do request to it from a browser and a Console Application (both on the same PC, the same of webserver) and I can access it using Android Emulator too.



Then I have an Android app in C# which should make a simple request (two methods):



using (var ws = new WebClient())
{
try
{
Uri uri = new
Uri("http://192.168.137.1:4100/1/2/3/4/5");
ws.DownloadStringAsync(uri);
}
catch (Exception ex)
{
Console.WriteLine(ex);
}
}
using (var cl = new HttpClient())
{
HttpResponseMessage res = await cl.GetAsync("http://192.168.137.1:4100/1/2/3/4/5");
Console.WriteLine(res.ToString());
}


But i can't access from it. I'm using Android 6.0.1 (API 23).

Some months ago this app was working, so I don't know if it a network problem or a device(smartphone) problem.



Can some one help me?










share|improve this question























  • Where is the Android app executed? On a physical smartphone? Or an emulator on your PC?

    – Alex
    Nov 13 '18 at 16:17











  • If i run it on the emulator works, but i need to run it on a physical smartphone.

    – Riccardo Raffini
    Nov 13 '18 at 16:19











  • So you run the server-app on your pc on port 4100 and the app on your physical device? In this case this sounds like a networking problem. Are both devices (pc and smartphone) in the same subnet, is port 4100 on your pc listening on all incoming ip-ranges, is your firewall configured to allow incoming tcp traffic on port 4100, do you have a proxy configured, ...?

    – Alex
    Nov 13 '18 at 16:23











  • They are in the same network (I'm using wi-fi). I've set a new incoming rule for port 4100 and I've disabled PC Firewall just in case. And I'm not using a proxy.

    – Riccardo Raffini
    Nov 13 '18 at 16:36











  • Can you access the url from a browser on your smartphone?

    – Alex
    Nov 13 '18 at 16:57
















0















I have a C# webserver running on my PC, i can do request to it from a browser and a Console Application (both on the same PC, the same of webserver) and I can access it using Android Emulator too.



Then I have an Android app in C# which should make a simple request (two methods):



using (var ws = new WebClient())
{
try
{
Uri uri = new
Uri("http://192.168.137.1:4100/1/2/3/4/5");
ws.DownloadStringAsync(uri);
}
catch (Exception ex)
{
Console.WriteLine(ex);
}
}
using (var cl = new HttpClient())
{
HttpResponseMessage res = await cl.GetAsync("http://192.168.137.1:4100/1/2/3/4/5");
Console.WriteLine(res.ToString());
}


But i can't access from it. I'm using Android 6.0.1 (API 23).

Some months ago this app was working, so I don't know if it a network problem or a device(smartphone) problem.



Can some one help me?










share|improve this question























  • Where is the Android app executed? On a physical smartphone? Or an emulator on your PC?

    – Alex
    Nov 13 '18 at 16:17











  • If i run it on the emulator works, but i need to run it on a physical smartphone.

    – Riccardo Raffini
    Nov 13 '18 at 16:19











  • So you run the server-app on your pc on port 4100 and the app on your physical device? In this case this sounds like a networking problem. Are both devices (pc and smartphone) in the same subnet, is port 4100 on your pc listening on all incoming ip-ranges, is your firewall configured to allow incoming tcp traffic on port 4100, do you have a proxy configured, ...?

    – Alex
    Nov 13 '18 at 16:23











  • They are in the same network (I'm using wi-fi). I've set a new incoming rule for port 4100 and I've disabled PC Firewall just in case. And I'm not using a proxy.

    – Riccardo Raffini
    Nov 13 '18 at 16:36











  • Can you access the url from a browser on your smartphone?

    – Alex
    Nov 13 '18 at 16:57














0












0








0








I have a C# webserver running on my PC, i can do request to it from a browser and a Console Application (both on the same PC, the same of webserver) and I can access it using Android Emulator too.



Then I have an Android app in C# which should make a simple request (two methods):



using (var ws = new WebClient())
{
try
{
Uri uri = new
Uri("http://192.168.137.1:4100/1/2/3/4/5");
ws.DownloadStringAsync(uri);
}
catch (Exception ex)
{
Console.WriteLine(ex);
}
}
using (var cl = new HttpClient())
{
HttpResponseMessage res = await cl.GetAsync("http://192.168.137.1:4100/1/2/3/4/5");
Console.WriteLine(res.ToString());
}


But i can't access from it. I'm using Android 6.0.1 (API 23).

Some months ago this app was working, so I don't know if it a network problem or a device(smartphone) problem.



Can some one help me?










share|improve this question














I have a C# webserver running on my PC, i can do request to it from a browser and a Console Application (both on the same PC, the same of webserver) and I can access it using Android Emulator too.



Then I have an Android app in C# which should make a simple request (two methods):



using (var ws = new WebClient())
{
try
{
Uri uri = new
Uri("http://192.168.137.1:4100/1/2/3/4/5");
ws.DownloadStringAsync(uri);
}
catch (Exception ex)
{
Console.WriteLine(ex);
}
}
using (var cl = new HttpClient())
{
HttpResponseMessage res = await cl.GetAsync("http://192.168.137.1:4100/1/2/3/4/5");
Console.WriteLine(res.ToString());
}


But i can't access from it. I'm using Android 6.0.1 (API 23).

Some months ago this app was working, so I don't know if it a network problem or a device(smartphone) problem.



Can some one help me?







c# android networking xamarin.android webserver






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 13 '18 at 16:05









Riccardo RaffiniRiccardo Raffini

115




115













  • Where is the Android app executed? On a physical smartphone? Or an emulator on your PC?

    – Alex
    Nov 13 '18 at 16:17











  • If i run it on the emulator works, but i need to run it on a physical smartphone.

    – Riccardo Raffini
    Nov 13 '18 at 16:19











  • So you run the server-app on your pc on port 4100 and the app on your physical device? In this case this sounds like a networking problem. Are both devices (pc and smartphone) in the same subnet, is port 4100 on your pc listening on all incoming ip-ranges, is your firewall configured to allow incoming tcp traffic on port 4100, do you have a proxy configured, ...?

    – Alex
    Nov 13 '18 at 16:23











  • They are in the same network (I'm using wi-fi). I've set a new incoming rule for port 4100 and I've disabled PC Firewall just in case. And I'm not using a proxy.

    – Riccardo Raffini
    Nov 13 '18 at 16:36











  • Can you access the url from a browser on your smartphone?

    – Alex
    Nov 13 '18 at 16:57



















  • Where is the Android app executed? On a physical smartphone? Or an emulator on your PC?

    – Alex
    Nov 13 '18 at 16:17











  • If i run it on the emulator works, but i need to run it on a physical smartphone.

    – Riccardo Raffini
    Nov 13 '18 at 16:19











  • So you run the server-app on your pc on port 4100 and the app on your physical device? In this case this sounds like a networking problem. Are both devices (pc and smartphone) in the same subnet, is port 4100 on your pc listening on all incoming ip-ranges, is your firewall configured to allow incoming tcp traffic on port 4100, do you have a proxy configured, ...?

    – Alex
    Nov 13 '18 at 16:23











  • They are in the same network (I'm using wi-fi). I've set a new incoming rule for port 4100 and I've disabled PC Firewall just in case. And I'm not using a proxy.

    – Riccardo Raffini
    Nov 13 '18 at 16:36











  • Can you access the url from a browser on your smartphone?

    – Alex
    Nov 13 '18 at 16:57

















Where is the Android app executed? On a physical smartphone? Or an emulator on your PC?

– Alex
Nov 13 '18 at 16:17





Where is the Android app executed? On a physical smartphone? Or an emulator on your PC?

– Alex
Nov 13 '18 at 16:17













If i run it on the emulator works, but i need to run it on a physical smartphone.

– Riccardo Raffini
Nov 13 '18 at 16:19





If i run it on the emulator works, but i need to run it on a physical smartphone.

– Riccardo Raffini
Nov 13 '18 at 16:19













So you run the server-app on your pc on port 4100 and the app on your physical device? In this case this sounds like a networking problem. Are both devices (pc and smartphone) in the same subnet, is port 4100 on your pc listening on all incoming ip-ranges, is your firewall configured to allow incoming tcp traffic on port 4100, do you have a proxy configured, ...?

– Alex
Nov 13 '18 at 16:23





So you run the server-app on your pc on port 4100 and the app on your physical device? In this case this sounds like a networking problem. Are both devices (pc and smartphone) in the same subnet, is port 4100 on your pc listening on all incoming ip-ranges, is your firewall configured to allow incoming tcp traffic on port 4100, do you have a proxy configured, ...?

– Alex
Nov 13 '18 at 16:23













They are in the same network (I'm using wi-fi). I've set a new incoming rule for port 4100 and I've disabled PC Firewall just in case. And I'm not using a proxy.

– Riccardo Raffini
Nov 13 '18 at 16:36





They are in the same network (I'm using wi-fi). I've set a new incoming rule for port 4100 and I've disabled PC Firewall just in case. And I'm not using a proxy.

– Riccardo Raffini
Nov 13 '18 at 16:36













Can you access the url from a browser on your smartphone?

– Alex
Nov 13 '18 at 16:57





Can you access the url from a browser on your smartphone?

– Alex
Nov 13 '18 at 16:57












0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53284978%2faccess-a-webserver-from-smartphone%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53284978%2faccess-a-webserver-from-smartphone%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Bressuire

Vorschmack

Quarantine