code optimised (wifi socket setup once while sending continuously) but will cause Segmentation fault