test aria2 on windows platform
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的更多相关文章
- 将Win8.1/WP8.1应用迁移到Universal Windows Platform
在上一篇在VS2015 RC打开CTP中创建的工程,我们介绍了怎么在RC中打开CTP中创建的Universal 工程,这一篇我们来讲下怎么将Windows 8.1/WP8.1的应用迁移到Univers ...
- 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 ...
- 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 ...
- C++ 11开发环境的搭建(Windows Platform)
C++ 11开发环境的搭建(Windows Platform) Code::Block IDE:Code::Blocks 12.11版本号 Compiler:TDM-GCC http: ...
- 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 ...
- 操作系统-Windows:UWP(Universal Windows Platform)
ylbtech-操作系统-Windows:UWP(Universal Windows Platform) 1.返回顶部 1. UWP即Windows 10中的Universal Windows Pla ...
- 如何将GridViewEX升级到UWP(Universal Windows Platform)平台
引言 上一篇文章中,我们主要讲解了如何在保证GridView控件的用户体验基础上,扩展GridView生成GridViewEx控件,增加动态添加新分组功能等,本文在上文的基础上,介绍如何在Window ...
- 异常:System.InvalidOperationException: This implementation is not part of the Windows Platform FIPS validated cryptographic algorithms FIPS信息标准限值了MD5加密
最近做的winform项目中,有个功能使用了MD5 加密,本地测试是没有问题的,但是上线后有些用户反馈说提示如下错误 一.问题描述 中文版错误截图 英语版错误截图 具体错误信息: 有关调用实时(JIT ...
- 异常: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 ...
随机推荐
- 列出python库的内置方法
import cv dir(cv) ['16SC', '16UC', '32FC', '32SC', '64FC', '8SC', '8UC', 'Abs', 'AbsDiff', 'AbsDiffS ...
- 微信小程序公共方法创建与调用
在根节点建个 utils 文件夹,在文件夹下建立 util.js 在util.js里面写入 var util = {}; util.getUserId= function(e, t) { ...
- kotlin基础 枚举
enum class WEEK {星期一,星期二,星期三,星期四,星期五,星期六,星期日} Kotlin 枚举类 枚举类最基本的用法是实现一个类型安全的枚举. 枚举常量用逗号分隔,每个枚举常量都是一个 ...
- 深入理解C++中的mutable,using,decltype等关键字
深入理解C++中的mutable关键字 mutable的中文意思是“可变的,易变的”,跟constant(既C++中的const)是反义词. 在C++中,mutable也是为了突破const的限制而设 ...
- Java数组移位和统计
package com.imooc.method; import java.util.InputMismatchException; import java.util.Scanner; public ...
- 闲聊一下百度的Unit
这几天在弄一个闲聊的机器人,想起之前的图灵机器人,捣鼓之后,发现用不了,咨询后得知,以前是可以免费使用,一天1000次,后来降到100次,其实也没有那么多人去闲聊,也无所谓,再后来,需要手持身份证实名 ...
- vux中XDialog组件,修改weui-mask(半透明遮罩)
场景:XDialog组件的遮罩的透明度是background: rgba(0, 0, 0, 0.6);而期望是75%的透明度: 项目构成:vue,vux 最终实现效果: 思路:首先想到了修改组件下we ...
- matlab学习笔记11_3高维数组操作 filp, shiftdim, size, permute, ipermute
一起来学matlab-matlab学习笔记11 11_3 高维数组处理和运算 filp, shiftdim, size, permute, ipermute 觉得有用的话,欢迎一起讨论相互学习~Fol ...
- [转]casperjs截图出现黑色背景
原文地址:https://my.oschina.net/tuxpy/blog/879509?utm_medium=referral 如果默认没有指定 body的background-color就会出现 ...
- nginx deny 封IP
官方文档地址:http://nginx.org/en/docs/http/ngx_http_access_module.html#deny Syntax: deny address | CIDR | ...