Skip to content

Socket.addError not supported #60400

Closed
Closed
@jakobleck

Description

@jakobleck

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.

Metadata

Metadata

Assignees

Labels

area-vmUse area-vm for VM related issues, including code coverage, and the AOT and JIT backends.library-iotriagedIssue has been triaged by sub teamtype-documentationA request to add or improve documentation

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions