Issue
I'm trying to get UDP messages send from clients in network, but when I create a new UdpClient I always get the exception:
System.Net.Sockets.SocketException: 'Access denied'
My Code for this very simple and woring perfect on console application, but not in Xamarin App.
public void Demo()
{
var Server = new UdpClient(80);
var ResponseData = Encoding.ASCII.GetBytes("SomeResponseData");
while (true)
{
var ClientEp = new IPEndPoint(IPAddress.Any, 0);
var ClientRequestData = Server.Receive(ref ClientEp);
var ClientRequest = Encoding.ASCII.GetString(ClientRequestData);
Console.WriteLine("Recived {0} from {1}, sending response", ClientRequest, ClientEp.Address.ToString());
Server.Send(ResponseData, ResponseData.Length, ClientEp);
}
}
I also saw this posting but this did not help me at all.
I'm using Android 11 for testing.
Solution
I found another post, this so you cant bind port 80 if you did not root your device.
Answered By - Nils.wtf
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.