byte[] getBytes(DATA_HEADER_SET str)
    {
        int size = Marshal.SizeOf(str);
        byte[] arr = new byte[size];

        IntPtr ptr = Marshal.AllocHGlobal(size);
        Marshal.StructureToPtr(str, ptr, true);
        Marshal.Copy(ptr, arr, 0, size);
        Marshal.FreeHGlobal(ptr);
        return arr;
    }
    void dataFromServer(byte[] data, int len)
    {
        DATA_SET_TO_SIMULATION_t _dataFromsimulationController = ByteArrayToNewStuff (data);
        bool sendImage = false;

        //Prüfen, um welchen Befehl es sich handelt
        if (_dataFromsimulationController.command == SIMULATION_COMMAND.SIMUCOM_SEND_IMAGE) {

            sendImage = true;
        }
        else if (_dataFromsimulationController.command == SIMULATION_COMMAND.SIMUCOM_UPDATE_DATA) {

            moveCarFunc(_dataFromsimulationController.speed_mms, _dataFromsimulationController.steering_angle, _dataFromsimulationController.timediff);
            _moveCarLights = _dataFromsimulationController.gpio_state;

            sendImage = true;

        }

        //Send Image to Client
        if (sendImage == true) {
            newScreen = true;
            while(newScreen==true){
            }

            DATA_HEADER_SET header = new DATA_HEADER_SET();
            header.type = DATA_HEADER_TYPE.IMAGE_JPEG;
            header.length = (UInt32)_cameraImage.Length;

            int hSize = Marshal.SizeOf(header);

            byte[] sendData = new byte[hSize+ header.length];
            Array.Copy(getBytes(header),sendData,hSize);
            Array.Copy(_cameraImage,0,sendData,hSize,header.length);
            if(_server.getClients().Count>0)
            {
                TcpClient c = _server.getClients()[0];

                if(!_server.sendData(c,sendData))
                {
                    _server.removeClient(c);
                }

            }
        }
    }