allow persistent socket connections

 * split up in readfromfd and sendeventstokinesis function
 * use channels for communication between them
 * adds retry on 500