中国DOS联盟论坛

China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
Guest | Log in | Register | Members | Search | China DOS Union
中国DOS联盟论坛
The time now is 2026-08-12 11:38
47,811 topics / 349,897 posts / today 0 new / 48,256 members
DOS批处理 & 脚本技术(批处理室) » Shut down after Thunder download
Printable Version  1,951 / 14
Floor1 gool123456 Posted 2010-04-24 21:01
初级用户 Posts 76 Credits 89
Thanks to everyone's suggestions, the accuracy of the judgment has been further improved.

This P processing is not very useful, just used as a reference here..

The code is written with Thunder 5. If you are not using Thunder 5, please change the name to your downloader's name. It has been tested that other downloaders can also be used, as long as you replace the name of the downloader with the following Thunder5.exe.

Save the following code as "Thunder Shutdown Monitoring.bat":



[ Last edited by gool123456 on 2010-5-6 at 21:49 ]
Floor2 gool123456 Posted 2010-04-24 21:06
初级用户 Posts 76 Credits 89
= = Forgot to change the uploaded file to the forum name. Hehe.
Floor3 exzzz Posted 2010-04-24 22:39
初级用户 Posts 167 Credits 194
This batch processing is quite boring...

You might as well write a simpler and more practical one that automatically monitors Thunder download tasks, and after completion, automatically transfers them to other directories to avoid Thunder uploading and affecting network speed.
Floor4 rs369007 Posted 2010-04-24 23:16
初级用户 Posts 131 Credits 147
Roughly looked at it, the original poster may not understand network protocols very well (actually I don't understand either).
SYN_SENT: is when using the connect function to initiate a connection
ESTABLISHED: means that a tcp connection has been established after three-way handshake and can start communication

Your judgment should first rule out the connection between Thunder and the Thunder server.
The tcp state displayed by netstat doesn't seem to be able to judge whether this port is transmitting data. After the tcp connection is established, the program can send data "at any time" through a certain port, and the state is still ESTABLISHED, so it can't be said that the tcp state is ESTABLISHED, it means that Thunder is downloading.

[ Last edited by rs369007 on 2010-4-24 at 23:26 ]
Floor5 gool123456 Posted 2010-04-25 00:11
初级用户 Posts 76 Credits 89
Originally posted by exzzz at 2010-4-24 22:39:
This batch processing is quite boring...


You might as well write a simpler and more practical one that automatically monitors Thunder download tasks and automatically transfers them to other directories after completion to avoid Thunder uploading and affecting internet speed.


This batch processing is also because a friend wanted to automatically shut down the computer when Thunder finishes downloading a specified task through a batch processing or without using third-party software. I added some small functions to this function. In fact, the real purpose is to be able to shut down the computer after downloading.

It's not really to make a downloader. That's not interesting.

If you are afraid that uploading will affect internet speed, it's better to just KILL it directly.

[ Last edited by gool123456 on 2010-4-25 at 14:01 ]
Floor6 slore Posted 2010-04-25 15:11
铂金会员 Posts 2,478 Credits 5,212
Doesn't it originally have this function?
Floor7 gool123456 Posted 2010-04-25 21:43
初级用户 Posts 76 Credits 89
Originally posted by slore at 2010-4-25 15:11:
Doesn't it have this function itself?

Yes, it's in the "Tools" menu of Thunder.
But monitoring with batch processing is also good. The advantage is that it monitors whether there is a connection without waiting for the connection to be disconnected and requested.

[ Last edited by gool123456 on 2010-4-25 at 21:44 ]
Floor8 exzzz Posted 2010-04-25 23:20
初级用户 Posts 167 Credits 194
Originally posted by gool123456 at 2010-4-25 09:43 PM:

It exists in the "Tools" menu of Thunder.
But monitoring with batch processing is also good. The advantage is that it monitors whether there is a connection, without waiting for the connection to be disconnected.

[ Last edited by gool123456 on 2010-4-25 at 21:44 ]



As someone mentioned upstairs, you didn't consider the situation of connecting to the server. After connecting to the server, there is also a connection established.


In addition, what I said, monitoring the tasks that Thunder has completed downloading and transferring them to other directories is not just killing.

You also need to consider these two problems of Thunder: 1. Thunder does not automatically exit after downloading. 2. After a certain task is downloaded, there are other tasks that need to be downloaded, and Thunder cannot be killed. I need it to download, not to upload.

[ Last edited by exzzz on 2010-4-25 at 23:22 ]
Floor9 lena Posted 2010-04-26 05:14
初级用户 Posts 67 Credits 154
Thunderstood, the original Chinese sentence is "迅雷不是有下载完毕自动关机吗?lZ这不是多此一举哇?". Translating it: "Doesn't Thunderbolt have an automatic shutdown when the download is complete? LZ, isn't this unnecessary?" But wait, actually "迅雷" is a software name, should be "Thunder", and "lZ" might be a typo for "LZ" which is "楼主" (post owner). So the correct translation should be: "Doesn't Thunder have an automatic shutdown when the download is complete? LZ, isn't this unnecessary?"
Floor10 gool123456 Posted 2010-04-26 18:19
初级用户 Posts 76 Credits 89
Originally posted by exzzz at 2010-4-25 23:20:

As mentioned by a certain person upstairs, you didn't consider the situation of connecting to the server. After connecting to the server, a connection is also established.

In addition, what I said, monitoring the completed tasks of Thunder...


If it's to limit Thunder's upload, I searched online and there are many methods. I used one method from Baidu Baike to write a sentence, which can be added



[ Last edited by gool123456 on 2010-4-26 at 18:44 ]
Floor11 gool123456 Posted 2010-04-26 18:21
初级用户 Posts 76 Credits 89
Originally posted by rs369007 at 2010-4-24 23:16:
Generally speaking, the LZ owner may not be very familiar with network protocols (actually, neither am I)
SYN_SENT: It is when the connect function is used to initiate a connection
ESTABLISHED: It means that a tcp connection has gone through three handshakes and then...


It seems very difficult to exclude server connections. According to strictness, the connection in the code is not accurate, because I am not calculating the downloading connection, but all normal connections.
That "echo Thunder is downloading.." seems a bit misleading others...
Currently, I haven't found a trick to judge whether Thunder is downloading. But if it is FTP downloading, actually, the file size can be calculated to judge the download speed.
Floor12 gool123456 Posted 2010-04-26 18:52
初级用户 Posts 76 Credits 89
Floor13 rs369007 Posted 2010-04-26 18:59
初级用户 Posts 131 Credits 147
Originally posted by gool123456 at 2010-4-26 18:21:


Actually, you can calculate the file size to judge the download....


I am following the idea of the original poster, monitoring the file size. However, I feel there are some difficulties and problems with this task.
1. Use the for extension to read the file size %%~zi. If the file is not completely downloaded, the size is still the full size of the entire file.

If monitoring the link status, assuming that the data transmission status can be monitored normally, but during the transmission process, the link may be accidentally terminated completely, which must be considered (such as loose network cable interface, switch failure, etc.). The link will be terminated after a certain period of time. Therefore, it is recommended to monitor the link status and check the integrity of the file.

[ Last edited by rs369007 on 2010-4-26 at 19:15 ]
Floor14 rs369007 Posted 2010-04-26 19:37
初级用户 Posts 131 Credits 147
I just checked the monitoring link. Under the tcp state, the one that initiates the active shutdown of the socket will enter the TIME_WAIT state. If possible, first record the connections between Thunder just started and all external IPs (record the IP and state), and check and compare every <4 minutes to see if there are new connections with other IPs that enter TIME_WAIT.

I also wrote network programs in C before. If Thunder actively calls shutdown or closesocket, it should be able to judge that Thunder's download dialogue with this "resource server" has ended this time.
Floor15 gool123456 Posted 2010-04-26 20:30
初级用户 Posts 76 Credits 89
Originally posted by rs369007 at 2010-4-26 18:59:


I am exactly the idea of the original poster, monitoring file size. But I feel there are some difficulties and problems with this task.
1. Use for expansion to read file size %%~zi. If the file is not completely downloaded, the size is still the entire file...

Hmm, it's a very good suggestion.
I tested it today and indeed found that sometimes Thunder doesn't stay in the normal connection state but can still download. I don't know if it's due to UDP connection or delayed traffic. (The premise is that I limited the download speed to 2K). I'm not very familiar with this aspect.

[ Last edited by gool123456 on 2010-4-26 at 20:54 ]
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023