finish coding writeToSocket function