Made socket operations synchronized. Status update.
Timer starts only if the app is connected
Code format and style. Replaced tabs for spaces.