tsocket/bsd: fix bug #7140 autodetect ipv4 and ipv6 based on the remote address if...