/** * TODO: Handle Reconnect * * Receives the message from the server * */ private void serverListener() { while (true) { try { IPEndPoint anyIP = new IPEndPoint(IPAddress.Any, 0); byte[] data = server.Receive(ref anyIP); string text = Encoding.UTF8.GetString(data); serverHandler.processMessage(text); } catch (ObjectDisposedException err) { Debug.LogError("Object disposed"); Debug.LogError(err.StackTrace); break; } catch (SocketException err) { Debug.LogError("Connection lost"); Debug.LogError(err.StackTrace); //break; } catch (Exception err) { Debug.LogError(err.ToString()); Debug.LogError(err.StackTrace); if (countErrors++ > 10) { Debug.LogError("Too many errors"); Application.Quit(); break; } } } }
public override void processMessage(byte[] message) { ultimatelyClient.processMessage(message); }