[FOLD] add detect logic
[FOLD] factor out plain socket differences