0

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?

devon t
  • 55
  • 2
  • 8

1 Answers1

1

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.

Programmer
  • 121,791
  • 22
  • 236
  • 328
  • Well that fixed it! Could you explain why the player targets the 2.0 subset instead of just 2.0. – devon t Oct 10 '17 at 13:33
  • It offers reduced build size and speed start up time. That's why Unity used it as a default settings. They also did this because only few people use raw socket in their games in Unity. They expect most people to be using their network API so making a default settings that reduces app size and increases startup time makes sense in this case. – Programmer Oct 10 '17 at 13:43
  • You are welcome. Don't forget to accept answer if you issue is solved. – Programmer Oct 10 '17 at 13:49