Skip to content

Fix the behavior of Socket.address  #50576

Open
@brianquinlan

Description

@brianquinlan

Change

Socket.address currently returns the same InternetAddress as Socket.remoteAddress. Instead, it should return the local address that the Socket was bound to.

The original bug is: dart:io, address getter of Socket returns wrong address.

Rationale

The current behavior is not useful. Instead, two connected sockets should have a relationship like:

Expect.equals(clientSocket.address, serverSocket.remoteAddress);
Expect.equals(clientSocket.remoteAddress, serverSocket.address);

There is a work-in-progress change in Gerrit.

Impact

It is hard to know how much existing code this will break. It does not break any Google tests and I would guess that it does not break much existing code.

Mitigation

Users can switch their code to use Socket.remoteAddress instead of Socket.address if they want the remote socket binding.

Metadata

Metadata

Assignees

Labels

area-vmUse area-vm for VM related issues, including code coverage, and the AOT and JIT backends.breaking-change-approvedbreaking-change-requestThis tracks requests for feedback on breaking changeslibrary-io

Type

No type

Projects

Status

Backlog

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions