I got two Windows UWP Apps. One of them (the "server") is running on a Raspberry Pi 2 on Windows IoT (10586.0). The other (the "client") is running on an
The first error
Exception thrown: 'System.Runtime.InteropServices.COMException' in mscorlib.ni.dll
WinRT information: No connection could be made because the target machine actively refused it.
This is because the socket is still open with a previous request and has not closed yet. So catch this error and try and to reconnect.
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.
This is because the server and client are on the same machine, I a running into this same problem supposedly you can run from an elevated command prompt
checknetisolation loopbackexempt -d -n= {package family}
to resolve it.
This solution did not work for me. So your server must run on a pi and client must run on your desktop PC for windows 10 UWP to be able to connect to it. Windows 10 does not allow loopback connection for UWP applications as far as I can tell.
If you truly want to run a socket server/web server node.js windows universal apps might be a good approach
https://ms-iot.github.io/content/en-US/win10/samples/NodejsWU.htm
or
RestUP https://github.com/tomkuijsten/restup
You should try using StreamSocket
API in UWP. This sample repo contents both server and client code: https://github.com/Microsoft/Windows-universal-samples/tree/master/Samples/StreamSocket
A method was called at an unexpected time. (Exception from HRESULT: 0x8000000E)
This error happened for me when I try to call ConnectAsync
twice in a row, I think you can check your logic or debug to confirm in your case.
Depending how much data you're talking about and what the end use case is, Amazon's AWS IoT Platform might be something to look at. It's pretty cool for a number of reasons. Specifically I like that the target device can be offline at the time of transmission.
It's free (250,000 messages) for the first year and $5 per one million messages after that. Every 512 byte block counts as 1 message credit.