private void SendSensorData(int imageWidth, int imageHeight)
 {
     imageWidth  = Math.Min(imageWidth, maxImageSize);
     imageHeight = Math.Min(imageHeight, maxImageSize);
     cameraSensor.TakePicture(image => {
         int responseSize    = 6 + imageWidth * imageHeight;
         BinaryWriter writer = new BinaryWriter(new MemoryStream(client.responseBuffer));
         writer.Write(carState.Disqualified);
         writer.Write(carState.Finished);
         // We can't transfer floating point values, so let's transmit velocity * 2^16
         int velocity = IPAddress.HostToNetworkOrder((int)(carController.GetVelocity() * 0xffff));
         writer.Write(velocity);
         carState.ResetState();
         WriteCameraImage(writer, image);
         client.socket.BeginSend(client.responseBuffer, 0, responseSize, 0, new AsyncCallback(SendCallback), client);
     }, imageWidth, imageHeight);
 }