the problem: While not using a VPN, the code below works fine. As soon as I connect to my home network via a VPN the, code throws an exception (translated from german):
A connection attempt failed because the connected party did not properly respond after a certain period of time, or established connection failed because connected host has failed to respond. (Exception from HRESULT: 0x8007274C).
The target "192.168.180.58" is an another computer within my home network.
Windows Store test code:
private async void createConnection(object sender, RoutedEventArgs e)
{
HostName target = new HostName("192.168.180.58");
string port = "8181";
using (StreamSocket client = new StreamSocket())
{
try
{
await client.ConnectAsync(target, port);
}
catch (Exception ex)
{
string typeName = ex.GetType().Name;
string msg = ex.Message;
}
}
}
I created a Windows Console Program (.NET 4.5.1) that is working in both situations (connected by using vpn and not using a vpn).
Windows Console test code:
namespace caPing
{
class Program
{
static void Main(string[] args)
{
string target = "192.168.180.58";
int port = 8181;
TcpClient client = new TcpClient();
try
{
client.Connect(target, port);
client.Close();
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
throw;
}
}
}
}
It looks like that the problem is somehow related to the execution environment for Windows Store Apps (when using a vpn).
What is the problem here and how can I solve it?
Kind regards,
Sörnt
I was facing the same problem then i found that
We can not keep two app running at the same time.
If Server app is running and then run the client app, the server app will
suspend and the client app will fail with connect.
You can create a server application as a desktop app, so that the client and
server can run at the same time.
From MSDN Here.
User contributions licensed under CC BY-SA 3.0