I am developing a client/server Javascript Windows 8 Metro application and I used Microsoft’s StreamSocket sample to make the communication between server and client happen. Now that I am almost done with the implementation, I don’t know how to test it on my computer, because it seems impossible to run the same application more than one time. Do you know any workaround for this problem?
One workaround (which is not actually a solution) is to copy the application many times into different projects and launch one of them as server and launch other ones as clients. Even using this approach, I could not connect my clients to the server instance. When server instance is not started, after client’s attempt for connecting to server, this error message is returned:
“No connection could be made because the target machine actively refused it.”
But, when the server instance is started and listens for connections, after client’s attempt for connecting to server, it waits for a while and then this error message is returned:
“A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.”
I know that using localhost for connecting clients to server is not supported, and because I am connected to network, I use my computer’s IP address as the clients’ address.
I also added these capabilities in both server and clients:
- Internet (Client)
- Internet (Client & Server)
- Private Networks (Client & Server)
The limitation of Windows Store apps not beeing allowed to establish a connection with
localhostcan be circumvented for debugging purposes usingCheckNetIsolation.exe. You can add an app to be exempt from the loopback isolation by calling:where the last part (
myapp_ecet6zh215f62e) is thePackage family nameof your app which can be found on thePackagingtab ofPackage.appxmanifestfile.You can also list all the apps that are already exempt:
More details about
CheckNetIsolation.execan be found here.All applications that are run from Visual Studio should already be exempt, though. Maybe there’s a firewall preventing your two app instances to connect. Try temporarily disabling it, just to be sure.
There’s no way to run multiple instances of your application on a single machine, at least not that I know of. In your case I’d probably install a virtual machine on my computer and run the second instance from there. This would be a better simulation of real environment anyway and you’d even avoid having to deal with loopback isolation.