added socket connection recovery (experimental)