Socket handling in daemon