private void ClientAcceptMessageFromServer()
 {
     try
     {
         Debug.Log("Client listening for connect response on port " + clientUdpClient.GetPort());
         IPEndPoint serverIpEndPoint = new IPEndPoint(IPAddress.Any, 0);
         // Receive is a blocking call
         byte[] receivedBytes = clientUdpClient.Receive(ref serverIpEndPoint);
         string message       = Encoding.UTF8.GetString(receivedBytes);
         HandleServerMessage(serverIpEndPoint, message);
     }
     catch (Exception e)
     {
         Debug.LogException(e);
     }
 }
 private void ServerAcceptMessageFromClient()
 {
     try
     {
         Debug.Log("Server listening for connect request on " + serverUdpClient.GetPort());
         IPEndPoint clientIpEndPoint = new IPEndPoint(IPAddress.Any, 0);
         // Receive is a blocking call.
         byte[] receivedBytes = serverUdpClient.Receive(ref clientIpEndPoint);
         string message       = Encoding.UTF8.GetString(receivedBytes);
         HandleClientMessage(clientIpEndPoint, message);
     }
     catch (Exception e)
     {
         if (e is SocketException se &&
             se.SocketErrorCode == SocketError.Interrupted &&
             hasBeenDestroyed)
         {
             // Dont log error when closing the socket has interrupted the wait for requests.
             return;
         }
         Debug.LogException(e);
     }
 }