Iam1337 / extOSC

extOSC is a tool dedicated to simplify creation of applications in Unity with OSC protocol usage.
MIT License
193 stars 25 forks source link

How to reconnect when Receiver fails? #21

Open baek-eng opened 2 years ago

baek-eng commented 2 years ago

I am seeing the following error message:

Error: [OSCReceiver] Receive error: System.Net.Sockets.SocketException (0x80004005): The socket is not connected
at System.Net.Sockets.SocketAsyncResult.CheckIfThrowDelayedException () [0x00000] in <00000000000000000000000000000000>:0
at System.Net.Sockets.Socket.EndReceiveFrom (System.IAsyncResult asyncResult, System.Net.EndPoint& endPoint) [0x00000] in <00000000000000000000000000000000>:0
at System.Net.Sockets.UdpClient.EndReceive (System.IAsyncResult asyncResult, System.Net.IPEndPoint& remoteEP) [0x00000] in <00000000000000000000000000000000>:0
at extOSC.Core.Network.OSCReceiverStandaloneBackend.Receive (System.Net.Sockets.UdpClient receivedClient, System.IAsyncResult result) [0x00000] in <00000000000000000000000000000000>:0
at extOSC.Core.Network.OSCReceiverStandaloneBackend.ControllerThread (System.IAsyncResult result) [0x00000] in <00000000000000000000000000000000>:0
at System.AsyncCallback.Invoke (System.IAsyncResult ar) [0x00000] in <00000000000000000000000000000000>:0
at System.Threading.WaitCallback.Invoke (System.Object state) [0x00000] in <00000000000000000000000000000000>:0
at System.Threading.ThreadPoolWorkQueue.Dispatch () [0x00000] in <00000000000000000000000000000000>:0

I am seeing that we're swallowing the exception here: https://github.com/Iam1337/extOSC/blob/5a8b8e17ba1abfd339a5fa033aaa552649ed537d/Assets/extOSC/Scripts/Core/Network/OSCReceiverStandaloneBackend.cs#L151

Is there a way to reconnect on receive failure? (or does it reconnect automatically?)

Iam1337 commented 2 years ago

Interesting, this is the first time I've seen this error. After it, most likely you need to reconnect. What are you sending and receiving to get this error?

baek-eng commented 2 years ago

We're just sending an array of floats (about 50-60 or so).