How to Setup MQTT Server on a Windows 10 Desktop

Download the Win32 installer from the below link (I couldn’t successfully installed the CygWin version) https://mosquitto.org/download/ Once downloaded, install the package During the start of the installation process it will show links from where some dependencies will have to be downloaded Copy/Open the links Once the installation finishes go to the websites opened in the… Continue reading How to Setup MQTT Server on a Windows 10 Desktop

Arduino – Communicate With Server – Part 3 – Web Based Panel

This is the code for the web based panel (web based UI) that will display the data received from arduino or can send some command to the Arduino All communications are done through a server (web server) The frontend code <?php date_default_timezone_set(“Asia/Kolkata”); $conn = mysql_connect(“localhost”,”root”,”xxxxxxxxxx”); if(!$conn) {     echo “Error: failed to connect DB”;   … Continue reading Arduino – Communicate With Server – Part 3 – Web Based Panel

Arduino – Communicate With Server – Part 2 – Server Code for Saving Data

This article shows the server side code for a server which is gathering or sending data by polling method to an Arduino device. This method or code is putting less load on the server (compared to socket) but data transmission is slower than socket. <?php date_default_timezone_set(“Asia/Kolkata”); $conn = mysql_connect(“localhost”,”root”,”**********”); if(!$conn) {     echo “Error: failed… Continue reading Arduino – Communicate With Server – Part 2 – Server Code for Saving Data

PHP Socket Client

This is a simple client that is running two different requests. One at every 2 seconds and another every 5 minutes. The 2 second one retrieved data from server and the 5 minute one sends data to server. <?php set_time_limit(0); ob_implicit_flush(); $host    = “xxx.xxx.xxx.xxx”; $port    = 1250; $lastUpdate = time(); while(1) {     if(time() -… Continue reading PHP Socket Client

PHP Socket Server – Running as Daemon and Multiple Connections

Code Courtesy: lars at opdenkamp dot eu A socket server written in PHP. This can accept multiple connections and runs as a daemon. pcntl_fork() is thing here that is making this all possible. <?php /** * Listens for requests and forks on each connection */ $__server_listening = true; //error_reporting(E_ALL); set_time_limit(0); ob_implicit_flush(); declare(ticks = 1); become_daemon();… Continue reading PHP Socket Server – Running as Daemon and Multiple Connections