UDP Client Event - OnPush

The event is raised when the client receives a packet as a push (packets that are not requested by the client) from Diarkis server cluster.

 

udp.OnPush += OnUdpPush;

private void OnUdpPush(uint ver, uint cmd, byte[] payload)
{
  // Consume payload accordingly using uint ver and cmd
  switch(ver)
  {
    case MY_CUSTOM_CMD_VER1:
      HandleCustomCmdVer1(cmd, payload);
    default:
      // Unknown command version... :( 

      break;
  }
}

private void HandleCustomCmdVer1(uint cmd, byte[] payload)
{
  switch(cmd)
  {
    case CMD1:
      HandleCmd1(payload);
      break;
  }
}