Hi,
When reading about sockets in UWP, I have seen that we can't use sockets to communicate between 2 apps in the same device with localhost. (Not sure exactly when it works and not).
I just need to clarify on that. If I connect to some other app running in the same device as my UWP app, should I be able to connect to that other app using System.Net.Sockets? Or it is not allowed?
My UWP app will be the client and there will be another app (most probably .net app) which works as the server. So if I call the server from my app like this it seems to work. But based on some articles I am not sure whether there are any restrictions on this. Will this work in a UWP app submitted to Store or will there be issues?
clientSocket = new Socket(AddressFamily.InterNetwork,
SocketType.Dgram, ProtocolType.Udp);
//IP address of the server machine
IPAddress ipAddress = IPAddress.Parse("127.0.0.1");
//Server is listening on port 1000
IPEndPoint ipEndPoint = new IPEndPoint(ipAddress, 1000);
epServer = (EndPoint)ipEndPoint;
clientSocket.BeginSendTo(byteData, 0, byteData.Length, SocketFlags.None, epServer, new AsyncCallback(OnSend), null);
Update : please see the Note here. https://learn.microsoft.com/en-us/windows/uwp/networking/sockets
It says 'Windows disallows establishing a socket connection (Sockets or WinSock) between two UWP apps running on the same machine'. So this applies only for 2 UWP apps? If one is a UWP app and the other is a .net app then it will not be an issue?
Thanks
Madhu