Closed
Description
The following minimal code example demonstrates that apparently you cannot use Socket.addError
: It throws Unsupported operation: Cannot send errors on sockets
. (run with dart 3.5.3 on a mac)
import 'dart:io';
void main() async {
int port = 33333;
ServerSocket serverSocket = await ServerSocket.bind(InternetAddress.anyIPv6, port);
serverSocket.listen((socket) async {
socket.addError("error");
});
await Socket.connect("127.0.0.1", port);
await Future.delayed(Duration(seconds: 1));
}
Is this a bug, and if not, should this be documented in the documentation? (Edit: Ok, I realized that Socket
is abstract, so maybe it makes no sense to describe implementation details in its doc...) There addError
just redirects to the doc of IOSink
, from which the method was inherited.