firing different sensor threads which sends data to same socket : My obvious search related  to  my problem  have  been  this link  so  far
http://stackoverflow.com/questions/1523916/how-to-handle-same-socket-in-different-threads but it  didnt  help  me in my pursuit. I have several sensor  threads which are fired at random intervals to a client  socket which in  turn sends that data  to the server socket.But i get issue when the sensor threads  are fired at the same time then the data of those  threads mixed  up.I dont want that behaviour  to happen.I want all those  threads to be fired distinctly without  being fired at  the  same  point  at  any time.Please  suggest me methods  in order  to  achieve  this.I have  been trying to  put sleep  on the sensor  threads  but i dont get the desired result

P.S-: I am emulating a test bench  environment  where the sensors are fired in different  threads (as if attached to client socket) to send data to this client on a different topics to the broker.