Search Unity

Access denied DatagramSocket.BindEndpointAsync

Discussion in 'Windows' started by badbod99, Sep 6, 2013.

  1. badbod99

    badbod99

    Joined:
    May 3, 2011
    Posts:
    36
    Hi All,

    I'm trying to receive data over UDP on my Windows Store Apps plugin. When the application tried to bind the socket I get the following error:

    I have set the Capabilities to InternetClient, InternetClientServer, PrivateNetworkClientServer from within the Publishing Settings in Unity.

    My code for connecting looks like this:

    Code (csharp):
    1.  
    2. public async void Start()
    3. {
    4.             socket = new DatagramSocket();
    5.             socket.MessageReceived += socket_MessageReceived;
    6.  
    7.             try
    8.             {
    9.                 await socket.BindEndpointAsync(null, config.Port.ToString());
    10.             }
    11.             catch (Exception e)
    12.             {
    13.                 Debug.Log(e.ToString());
    14.                 Debug.Log(SocketError.GetStatus(e.HResult).ToString());
    15.                 return;
    16.             }
    17. }
    18.  
    Anyone have any idea what I need to change to give my application permissions to receive data on UDP? Or if I'm doing something wrong here in my code?

    Thanks

    - Simon
     
  2. badbod99

    badbod99

    Joined:
    May 3, 2011
    Posts:
    36
    Found it. I had changed the publishing settings but not deleted the original project. As Unity doesn't overwrite project or solution info, which is where this stuff is apparently stored, it didn't update the publishing settings. Deleted the project, rebuilt and no error. I'm still not getting any UDP data, but it's a start :)