[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Checking refusal of a network connection

On 2019-06-01 19:15:28 +0200, Markus Elfring wrote:
> >> connect(3, {sa_family=AF_INET, sin_port=htons(37351), sin_addr=inet_addr("")}, 16) = -1 ECONNREFUSED (Connection refused)
> > 	Without seeing the code, I'd be suspicious of that difference.
> I would expect that the IPv4 address from such a connection attempt
> would be automatically converted to a IPv6 loopback address.

You haven't said which OS you are using, but as far as I know this
expectation will be frustrated at least on Linux: There ::1 and are distinct addresses. If you want to accept connections on
both, you have to listen on both (or on ::, which does accept
connections on all IP addresees - IPv6 and IPv4).


   _  | Peter J. Holzer    | we build much bigger, better disasters now
|_|_) |                    | because we have much more sophisticated
| |   | hjp at         | management tools.
__/   | | -- Ross Anderson <>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <>