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. 【技术博客】Pytorch代码生成

    开发组在开发过程中,都不可避免地遇到了一些困难或问题,但都最终想出办法克服了.我们认为这样的经验是有必要记录下来的,因此就有了[技术博客]. Pytorch代码生成经验文档 关于模型代码的生成,主要思 ...

  2. 使用ssh-keygen生成私钥和公钥

    1.使用ssh-keygen生成私钥和公钥 命令如下: ssh-keygen -t rsassh-keygen -t rsa -C "用户名自取"可以是邮箱 例子: fdipzon ...

  3. Windows通过URL启动本机App

    Windows通过URL启动本机App http://xxx.itdhz.com/?file=001-Windows/100-Windows通过URL启动本机App

  4. A Full Hardware Guide to Deep Learning深度学习电脑配置

     https://study.163.com/provider/400000000398149/index.htm?share=2&shareId=400000000398149( 欢迎关注博 ...

  5. HandlerMethodArgumentResolver的抽象實現AbstractNamedValueMethodArgumentResolver下的子类

    Annotation-based argument resolution 部分2 org.springframework.web.servlet.mvc.method.annotation.Reque ...

  6. java判断是excel2003还是2007以上

    public static Workbook create(InputStream in) throws IOException,InvalidFormatException { if (!in.ma ...

  7. osgearth显示中文标签

    首先将带有中文的字符串转换成string void unicodeToUTF8(const wstring &src, string& result){int n = WideChar ...

  8. Cassandra开发入门文档第四部分(集合类型、元组类型、时间序列、计数列)

    Cassandra 提供了三种集合类型,分别是Set,List,MapSet: 非重复集,存储了一组类型相同的不重复元素,当被查询时会返回排好序的结果,但是内部构成是无序的值,应该是在查询时对结果进行 ...

  9. jzy3D从入门到弃坑_4尝试使用jzy3D1.0画图失败

    jzy3D从入门到弃坑_4 尝试使用jzy3D1.0画图失败 觉得有用的话,欢迎一起讨论相互学习~Follow Me 记录一下使用jzy3D1.0失败 究其原因在于 本人才疏学浅,对于JAVA ope ...

  10. PMP 第5章错题总结

    1.工作分解结构是项目团队与相关方之间沟通的有效工具之一2.控制账户是工作分解结构某个层次上的要素,以便与工作包一一对应3.项目范围说明书包括产品范围.产品验收标准.项目可交付成果.项目除外责任,以及 ...