Attacks on Resource-Constrained IoT Devices and Security Solutions