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
.
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.
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.
Users can switch their code to use Socket.remoteAddress
instead of Socket.address
if they want the remote socket binding.