I have created a networking api that I use in my applications. When compiling the unity project and running in the standalone windows player I receive the following exceptions which prevent my app from sending/receiving udp packets.
NotSupportedException: Operation is not supported.
at System.Net.Sockets.SocketAsyncEventArgs.DoOperation
(SocketAsyncOperation operation, System.Net.Sockets.Socket socket) [0x00000]
in <filename unknown>:0
at System.Net.Sockets.Socket.ReceiveFromAsync
(System.Net.Sockets.SocketAsyncEventArgs e) [0x00000] in <filename
unknown>:0
at DivergentNetwork.DnlUdpClient.BeginReceive () [0x00000] in <filename
unknown>:0
at DivergentNetwork.DnlUdpClient.Start () [0x00000] in <filename
unknown>:0
at UdpClient.Start () [0x00000] in <filename unknown>:0
I am thinking it's something to do with standalone player however I can't figure out exactly what it is. I know this because I can run the app in Unity Editor successfully without errors.
If the SAEA class turns out to be unsupported with Unity then what would be the preferred alternative?
You need to change the Compatible Level to .NET 2.0 .
Go File --> Build Settings then select your Platform. Click on the Player Settings. Go to Other Settings on the right. On the API Compatible Level drop-down menu, change it to .NET 2.0 instead of .NET 2.0 Subset.