RawSocketOption.fromInt constructor

RawSocketOption.fromInt(
  1. int level,
  2. int option,
  3. int value
)

Convenience constructor for creating an integer based RawSocketOption.

Implementation

factory RawSocketOption.fromInt(int level, int option, int value) {
  final Uint8List list = Uint8List(4);
  final buffer = ByteData.view(list.buffer, list.offsetInBytes);
  buffer.setInt32(0, value, Endian.host);
  return RawSocketOption(level, option, list);
}

© 2012 the Dart project authors
Licensed under the Creative Commons Attribution-ShareAlike License v4.0.
https://api.dart.dev/stable/2.13.0/dart-io/RawSocketOption/RawSocketOption.fromInt.html