import 'dart:io';
import 'dart:convert';
import 'package:path/path.dart';
import 'package:web_socket_channel/io.dart'; //https://dldir1.qq.com/qqfile/qq/PCQQ9.1.3/25323/QQ9.1.3.25323.exe String gid = '';
bool firstRun = true; main()async{
print('1');
createConnection(); print('2');
await Future.delayed(Duration(seconds: 1));
createConnection(); print('3');
await Future.delayed(Duration(seconds: 1));
createConnection(); String url = 'https://dldir1.qq.com/qqfile/qq/PCQQ9.1.3/25323/QQ9.1.3.25323.exe'; var s = IOWebSocketChannel.connect('ws://localhost:6800/jsonrpc');
s.stream.listen(onData, onDone: onDone, onError: onError);
Map task = {"jsonrpc":"2.0","id":"m","method":"aria2.addUri","params":["token:studyaria2",["$url"]]};
s.sink.add(json.encode(task)); await Future.delayed(Duration(seconds: 1));
while(true){
checkStatus(s, gid);
await Future.delayed(Duration(seconds: 1));
} } checkStatus(IOWebSocketChannel channel, String gid){
Map task = {"jsonrpc":"2.0","id":"m","method":"aria2.tellStatus",
"params":[
"token:studyaria2",
"$gid",
["gid", "status", "totalLength", "completedLength", "downloadSpeed","files"]
]
};
channel.sink.add(json.encode(task));
} createConnection()async{
String aria2 = 'C:\\Users\\gshao\\aria2\\aria2c';
var a = await Process.run(aria2, [r'--conf-path=C:\Users\gshao\aria2\aria2.conf']);
await Future.delayed(Duration(seconds: 1));
var xx = await a.exitCode;
print('create ok 1: $a');
print('create ok 2 status: ${a.stdout}');
print('create ok 3 error:${a.stderr}');
print('create ok 4 exitcode:,');
} onData(v){
print('onData: $v');
if(firstRun){
gid = json.decode(v)['result'];
firstRun = false;
print('gid:::::::::::: $gid');
} } onDone(){
print('1, done');
} onError(e){
print('2, error: ${e.toString()}');
}

  

test aria2 on windows platform的更多相关文章

  1. 将Win8.1/WP8.1应用迁移到Universal Windows Platform

    在上一篇在VS2015 RC打开CTP中创建的工程,我们介绍了怎么在RC中打开CTP中创建的Universal 工程,这一篇我们来讲下怎么将Windows 8.1/WP8.1的应用迁移到Univers ...

  2. This implementation is not part of the Windows Platform FIPS validated cryptographic algorithms

    异常消息:This implementation is not part of the Windows Platform FIPS validated cryptographic algorithms ...

  3. This implementation is not part of the Windows Platform FIPS validated cryptographic algorithms. 此实现不是 Windows 平台 FIPS 验证的加密算法的一部分 解决方案

    但web启用了md5加密后 有可能出现这样的错误 This implementation is not part of the Windows Platform FIPS validated cryp ...

  4. C++ 11开发环境的搭建(Windows Platform)

    C++ 11开发环境的搭建(Windows Platform) Code::Block IDE:Code::Blocks  12.11版本号 Compiler:TDM-GCC        http: ...

  5. DEPLOYING NATIVE UWP (UNIVERSAL WINDOWS PLATFORM) APPS FOR JAVA DEVELOPERS & PUBLISHING THEM TO THE MICROSOFT STORE

    原文: DEPLOYING NATIVE UWP (UNIVERSAL WINDOWS PLATFORM) APPS FOR JAVA DEVELOPERS & PUBLISHING THEM ...

  6. 操作系统-Windows:UWP(Universal Windows Platform)

    ylbtech-操作系统-Windows:UWP(Universal Windows Platform) 1.返回顶部 1. UWP即Windows 10中的Universal Windows Pla ...

  7. 如何将GridViewEX升级到UWP(Universal Windows Platform)平台

    引言 上一篇文章中,我们主要讲解了如何在保证GridView控件的用户体验基础上,扩展GridView生成GridViewEx控件,增加动态添加新分组功能等,本文在上文的基础上,介绍如何在Window ...

  8. 异常:System.InvalidOperationException: This implementation is not part of the Windows Platform FIPS validated cryptographic algorithms FIPS信息标准限值了MD5加密

    最近做的winform项目中,有个功能使用了MD5 加密,本地测试是没有问题的,但是上线后有些用户反馈说提示如下错误 一.问题描述 中文版错误截图 英语版错误截图 具体错误信息: 有关调用实时(JIT ...

  9. 异常:System.InvalidOperationException: This implementation is not part of the Windows Platform FIPS validated cryptographic algorithms 这个实现是不是Windows平台FIPS验证的加密算法。解决方法

    遇见这个问题是在使用了MD5加密算法后报错的,可能的原因如下: 1.FIPS不兼容MD5,此时需要修改注册表 HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\C ...

随机推荐

  1. .Net Core3 新特性整理

    .net core 3实现了.net 标准2.1. 1.生成可执行文件 以前版本需要dotnet run运行项目,.net core 3支持直接生成目标平台的可执行文件.比如windows就是exe了 ...

  2. 【转】干货篇:手机绕过BL锁9008模式强刷

    <ignore_js_op> 高通QPST线刷其实就是利用高通芯片自带的9008端口,将手机系统内的所有分区的镜像文件,直接刷写手机.这个刷机方式比REC卡刷和fastboot线刷,更底层 ...

  3. Rose与PowerDesigner:两款UML建模工具的对比

    声明 本文转载自:Rose与PowerDesigner:两款UML建模工具的对比 正文 本文和大家重点讨论一下Rose与PowerDesigner:两款UML建模工具的对比,Rose和PowerDes ...

  4. ChannelEventRunnable handle RECEIVED operation error, channel is NettyChannel解决方法

    [] 2019-11-23 16:17:40 [3673645] [c.a.d.r.t.d.ChannelEventRunnable]-[WARN] DubboServerHandler-10.20. ...

  5. MLflow系列3:MLflow项目

    英文链接:https://mlflow.org/docs/latest/projects.html 本文链接:https://www.cnblogs.com/CheeseZH/p/11945432.h ...

  6. java.lang.Exception: No tests found matching

    java.lang.Exception: No tests found matching 需要导入junit.jar 和 hamcrest.jar

  7. 求解未知数——yjy题库

    /* 未知数 p1,p2,p3,p4,p5,满足: (1) p1 与 p3 均为 2 位的正整数:p5 为 3 位的正整数: (2) p2 与 p4 低两位(例:数值‘123’取低两位则为‘23’)数 ...

  8. vmare_mac 关闭完整性检查

    今天在vmware 15 安装mac10.13,安装之后不能全屏,查了很多资料最后完美解决 首先我们需要进入mac的恢复模式 等待出现苹果LOGO,直到进度条加载完毕 然后打开实用工具-终端 关闭SI ...

  9. async异步流程控制神器

    async https://www.npmjs.com/package/async Async is a utility module which provides straight-forward, ...

  10. 深入解读阿里云Redis开发规范

    Key命名设计:可读性.可管理性.简介性 规范建议使用冒号即:进行分割拼接,因为很多Redis客户端是根据冒号分类的.比如有几个Key:apps:app:1.apps:app:2和apps:app:3 ...