sendSync method

  1. @override
void sendSync({
  1. required List<int> value,
  2. Duration durationTimeOut = const Duration(minutes: 1),
})
override

Implementation

@override
void sendSync({
  required List<int> value,
  Duration durationTimeOut = const Duration(minutes: 1),
}) {
  DateTime dateTime = DateTime.now().add(durationTimeOut);
  while (true) {
    sleep(Duration(microseconds: 10));
    if (dateTime.isBefore(DateTime.now())) {
      throw SocketError({
        "@type": "socketError",
        "message": "send_data_time_out",
        "description": "Send Data time out "
      });
    }

    if (isConnect) {
      break;
    }
  }
  return socket.add(value);
}