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. mysql 导出查询结果

    show variables like '%secure%'; 看看导出位置 SELECT * FROM tb WHERE sn = '1' LIMIT 1,10into outfile '/var/ ...

  2. Netty - PooledByteBufAllocator

    堆外内存, 就是非JVM管理的,由os管理的内存,等同于c语言里面的mallco分配的内存 故堆外内存的好处, 1. 不会有GC回收,缓解gc压力 2. 避免一次copy,发生到socket buff ...

  3. TCP 粘包问题

    TCP 粘包,主要是因为发送端发送的两个包,TCP按照流进行发送,缓冲器满了才发送. 假如两个包都比较小的话,就会把两个包合并到一起进行发送,造成接收端接到的流无法知道这是一个包还是两个包 假如发送两 ...

  4. react问题You must install peer dependencies yourself.

    npm WARN react-native@0.46.4 requires a peer of react@16.0.0-alpha.12 but none is installed. You mus ...

  5. Java学习-055-Jsoup爬虫通过设置获取响应数据大小的最大值,解决因默认获取 1MB 响应数据导致的无法获取全部的响应数据内容问题

    在日常工作中,通常会遇到获取各种网络数据使用的情况,Java中可使用Jsoup(Python中可使用 BeatifulSoup)进行数据的获取及处理. 今天有朋友问,在使用 Jsoup 进行请求数据时 ...

  6. Linux(CentOS)启动时自动执行脚本(rc.local)

    一.Linux开机启动有多种方法,比如我设置mysql开机启动为:chkconfig --level 35 mysqld on 二.下面说说通过rc.local文件进行开机启动: 1.首先创建一个启动 ...

  7. (原)关于OpenSL ES播放音频数据的一个奇怪的问题

    关于OpenSL ES播放音频数据的一个奇怪的问题 Author:lihaiping1603@aliyun.com 最近用业余时间做了一个android平台的播放器sdk,其中视频用的opengl e ...

  8. CSS继承控制:inherit、initial和unset

    CSS里有三种常用的属性值继承方式:inherit,initial和unset.我们用一个简单的例子来演示一下: <ul style="color: green;"> ...

  9. log4j Logger 使用简介

    项目结构: log4j.properties 内容: log4j.rootCategory=info,stdout log4j.appender.stdout=org.apache.log4j.Con ...

  10. FTP 客户端工具(支持 Windows/Unix/Linux)

    FTP 客户端工具,支持 Windows/Unix/Linux