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. Java编程思想之七复用类

    复用代码是Java众多引人注目的功能之一.但要想成为极具革命性的语言,仅仅能够复制代码并对之加以改变是不够的,它还必须做更多的事情. 使用类而不破坏程序代码: 在新类中产生现有对象.由于新的类是由现有 ...

  2. Django实现自动发布(3发布-升级和回退)

    发布实际上就是将服务的某个版本和一台主机关联,我用一张表(MicroServiceInstance)记录了主机id.服务id.版本id,目前一台主机只能部署一个版本,所以主机id和服务id要做联合索引 ...

  3. 华为云ARM64服务器试用

    公司同事弄了个华为云的ARM64服务器,让我帮忙部署我们的服务,所以先试用了一下. 总体感觉还行,使用的CentOS系统,yum也能用,epel源也可以用.但是SCL软件集用不了. uname -a ...

  4. MQTT研究之EMQ:【EMQX使用中的一些问题记录(1)】

    issue 1. EMQX的共享订阅 EMQX是一个非常强大的物联网通信消息总线,基于EMQX开展应用开发,要注意很多配置细节问题,这里要说到的就是共享订阅以及和cleanSession之间的关系问题 ...

  5. Linux远程连接ssh工具(FinalShell)xshell替代神器

    对对对 FinalShell SSH工具,服务器管理,远程桌面加速软件,支持Windows,macOS,Linux,版本2.9.8,更新时间2019.6.19 wntr 2017-01-17 11:0 ...

  6. 关于OpenGPU.org

    今天是心情沉重的一天. OpenGPU.org,作为当年中国图形学界首屈一指的论坛,曾经创造过日访问破万的记录,而且汇聚了中国所有的图形行业的精英,大家畅所欲言,为整个中国图形学业界分享了无数宝贵的资 ...

  7. 文档工具的王者Sphinx

    Sphinx https://www.sphinx.org.cn/ Sphinx是一个工具,可以轻松创建由Georg Brandl编写并根据BSD许可证授权的智能和美观文档 它最初是为Python文档 ...

  8. (原)理解码率控制模式(x264,x265,vpx)

    理解码率控制模式(x264,x265,vpx) 原文链接:https://slhck.info/video/2017/03/01/rate-control.html 翻译:lihaiping1603@ ...

  9. 使用VEGAS2(Versatile Gene-based Association Study)进行gene based的关联分析研究

    gene-based关联分析研究是SNP-based关联分析研究的一个补充. 目前有很多工具支持gene-based关联分析研究,比如GCTA,VEGAS2等. 下面主要介绍一下怎么用VEGAS2做g ...

  10. eclipse 中的注释 快捷键 多行注释快捷键 单行注释快捷键

    本文链接:https://blog.csdn.net/a0701302/article/details/76177244 Eclipse 中的两种注释方法: (1)多行注释 (2)单行注释 一. 多行 ...