Skip to content

socket.remoteAddress is always undefined once called before connect #43009

Description

@szmarczak

Version

v18.1.0

Platform

Linux pop-os 5.16.19-76051619-generic #202204081339~1649696161~21.10~091f44b SMP PREEMPT Mon Apr 11 17 x86_64 x86_64 x86_64 GNU/Linux

Subsystem

net

What steps will reproduce the bug?

const net = require('net');

const socket = net.connect(443, 'example.com');

console.log(socket.connecting, socket.remoteAddress);

socket.on('connect', () => {
    console.log(socket.remoteAddress);
});

How often does it reproduce? Is there a required condition?

Always. Regressed since v15.0.0.

What is the expected behavior?

true undefined
[IP]

What do you see instead?

true undefined
undefined

Additional information

Looks like the culprit is 1428db8

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    netIssues and PRs related to the net subsystem.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions