write method

Future<bool> write(
  1. ClientChannelType channel,
  2. Uint8List buffer,
  3. int timeout
)

数据发送,用于发送原始数据

Implementation

Future<bool> write(
    ClientChannelType channel, Uint8List buffer, int timeout) async {
  if (p2pConnectState != ClientConnectState.CONNECT_STATUS_ONLINE) {
    return false;
  }
  int clientPtr = await getClientPtr();
  int ret =
      await AppP2PApi().clientWrite(clientPtr, channel, buffer, timeout);
  return ret == buffer.length;
}