New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RawDatagramSocket.multicastInterface= not implemented #17057
Comments
Removed Area-IO label. |
Confirmed this is still an issue in Dart 2:
|
I want this for support for a Multicast DNS client. |
Quick update on this - I'm working on implementing a more generic interface for setting socket options. Setting the multicast interface is very significantly different for IPv4 vs. IPv6. This property can't sensibly be implemented without breaking it, and making it much different from the other options exposed in this manner. Exposing the ability to set arbitrary options will help to fix that. |
This allows developers to have more fine grained control over socket options supported by their platforms, particularly when there is not a nice way to encapsulate differences between IPv4 and IPv6 options (as with IP_MULTICAST_IF and IPV6_MULTICAST_IF). It also begins the work of exposing socket level and option values, although keeping it for now only to a minimum necessary to assist with setting the multicast interface for datagram sockets. This CL also marks `multicastInterface` as deprecated. Bug: #17057 Change-Id: I39b3bf3d32d39de1c777acea4425d6eb2226355d Reviewed-on: https://dart-review.googlesource.com/c/89164 Commit-Queue: Zach Anderson <zra@google.com> Reviewed-by: Zach Anderson <zra@google.com>
As of 5b1daaa, this property is marked The way to do this now is: if (targetAddress.type == InternetAddressType.IPv4) {
socket.setRawOption(RawSocketOption(
RawSocketOption.levelIPv4,
RawSocketOption.IPv4MulticastInterface,
address.rawAddress, // where address is an InternetAddress
));
} else {
socket.setRawOption(RawSocketOption.fromInt(
RawSocketOption.levelIPv6,
RawSocketOption.IPv6MulticastInterface,
interface.index, // where interface is a NetworkInterface
));
} |
So @dnfield , can we close this issue? |
This issue was originally filed by j.m.s...@gmail.com
What steps will reproduce the problem?
What is the expected output? What do you see instead?
The socket should now send all multicast packet out of the network card represented by the NetworkInterface object. Instead it throws an exception and fails with a stack trace.
$ dart multicast_eth0_send.dart
found eth0
Uncaught Error: Not implemented
Stack Trace:
0 _RawDatagramSocket.multicastInterface= (dart:io-patch/socket_patch.dart:1513)
1 openUdpSocket.<anonymous closure> (file:///home/james/projects/dart/udpsockets/multicast_eth0_send.dart:22:7)
2 _Future._propagateToListeners.<anonymous closure> (dart:async/future_impl.dart:453)
3 _rootRun (dart:async/zone.dart:683)
4 _RootZone.run (dart:async/zone.dart:832)
5 _Future._propagateToListeners (dart:async/future_impl.dart:445)
6 _Future._complete (dart:async/future_impl.dart:303)
7 _Future._asyncComplete.<anonymous closure> (dart:async/future_impl.dart:354)
8 _asyncRunCallback (dart:async/schedule_microtask.dart:18)
9 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:119)
Unhandled exception:
Not implemented
0 _rootHandleUncaughtError.<anonymous closure>.<anonymous closure> (dart:async/zone.dart:677)
1 _asyncRunCallback (dart:async/schedule_microtask.dart:18)
2 _asyncRunCallback (dart:async/schedule_microtask.dart:21)
3 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:119)
What version of the product are you using? On what operating system?
Dart VM version: 1.1.3 (Thu Feb 6 00:04:34 2014) on "linux_x64"
Please provide any additional information below.
The API documentation states that this property should be settable.
https://api.dartlang.org/apidocs/channels/stable/#dart-io.RawDatagramSocket@id_multicastInterface
Please see attached file for an example. if you comment out line 22 s.multicastInterface = interface;
then this program works fine.
Attachment:
multicast_eth0_send.dart (1 KB)
The text was updated successfully, but these errors were encountered: