Click here to Skip to main content
15,923,852 members
Home / Discussions / C#
   

C#

 
AnswerRe: Thread, WaitSleepJoin Pin
Luc Pattyn21-Jul-07 6:22
sitebuilderLuc Pattyn21-Jul-07 6:22 
GeneralRe: Thread, WaitSleepJoin Pin
Johan Martensson21-Jul-07 6:54
Johan Martensson21-Jul-07 6:54 
GeneralRe: Thread, WaitSleepJoin Pin
Luc Pattyn21-Jul-07 7:13
sitebuilderLuc Pattyn21-Jul-07 7:13 
GeneralRe: Thread, WaitSleepJoin Pin
Luc Pattyn21-Jul-07 7:28
sitebuilderLuc Pattyn21-Jul-07 7:28 
GeneralRe: Thread, WaitSleepJoin Pin
Johan Martensson21-Jul-07 7:49
Johan Martensson21-Jul-07 7:49 
GeneralRe: Thread, WaitSleepJoin Pin
Luc Pattyn21-Jul-07 8:18
sitebuilderLuc Pattyn21-Jul-07 8:18 
GeneralRe: Thread, WaitSleepJoin Pin
Johan Martensson21-Jul-07 9:18
Johan Martensson21-Jul-07 9:18 
GeneralRe: Thread, WaitSleepJoin Pin
Luc Pattyn21-Jul-07 9:54
sitebuilderLuc Pattyn21-Jul-07 9:54 
Hi,

lazaruz wrote:
FileShare is no problem as I create four different files and will piece them together in the end.


Right, I agree the client is OK on this, but my comment applied to the server: the server
needs to be capable of reading the same file more than once, hence it
must open it every time in such a way that it does not prevent another thread from also
opening it for reading. But since you tried several servers, that should not be the issue.


I studied the DownloadFile() method, and that seems OK too.
I was surprised to see yet another thread created. That's really one thread too many
(actually, its the other one that now has no further purpose, you could remove the thread
stuff entirely from the code you have shown at the beginning, that's the line
dThreads.Add(new Thread(new ParameterizedThreadStart(test))); and following lines.

I noticed you end the download thread with a suicide
if(thrDownload != null) thrDownload.Abort();
there is absolutely no need for that; when the method reaches its end (or otherwise returns)
the thread is done automatically.

This also applies to the test() method (the one I told you does not need separate
threads any longer), I havent seen the code at the end of it, but the log shows
the thread gets aborted...

What you can also see in the log is the four threads work completely sequentially:
the second thread does not even start before the first is all done; but they all are
very short, which is normal since all they do is they each start another thread inside
DownloadFile(). So everything here is looking OK.

So I now must suggest:
- you remove the redundant threading stuff in main or whatever it is called, not in
Download class.
- you add timestamp logging to the download class (just copy the method to that class,
and insert new log statements, at least before and after GetResponseStream(); more is better.

We definitely are getting closer now !

BTW: please also show the code for CalculateDownloadingInfo() since that is part of
what runs four times.

Smile | :)


GeneralRe: Thread, WaitSleepJoin Pin
Johan Martensson21-Jul-07 10:39
Johan Martensson21-Jul-07 10:39 
GeneralRe: Thread, WaitSleepJoin Pin
Luc Pattyn21-Jul-07 11:03
sitebuilderLuc Pattyn21-Jul-07 11:03 
GeneralRe: Thread, WaitSleepJoin Pin
Johan Martensson21-Jul-07 11:32
Johan Martensson21-Jul-07 11:32 
GeneralRe: Thread, WaitSleepJoin Pin
Luc Pattyn21-Jul-07 11:51
sitebuilderLuc Pattyn21-Jul-07 11:51 
GeneralRe: Thread, WaitSleepJoin Pin
Luc Pattyn21-Jul-07 13:08
sitebuilderLuc Pattyn21-Jul-07 13:08 
GeneralRe: Thread, WaitSleepJoin Pin
Johan Martensson21-Jul-07 22:14
Johan Martensson21-Jul-07 22:14 
GeneralRe: Thread, WaitSleepJoin Pin
Luc Pattyn22-Jul-07 0:34
sitebuilderLuc Pattyn22-Jul-07 0:34 
GeneralRe: Thread, WaitSleepJoin Pin
Johan Martensson24-Jul-07 0:15
Johan Martensson24-Jul-07 0:15 
GeneralRe: Thread, WaitSleepJoin Pin
Luc Pattyn24-Jul-07 1:01
sitebuilderLuc Pattyn24-Jul-07 1:01 
GeneralRe: Thread, WaitSleepJoin Pin
Johan Martensson24-Jul-07 8:21
Johan Martensson24-Jul-07 8:21 
GeneralRe: Thread, WaitSleepJoin Pin
Luc Pattyn24-Jul-07 11:54
sitebuilderLuc Pattyn24-Jul-07 11:54 
QuestionDataSource binding problem Pin
~~~Johnny~~~21-Jul-07 3:27
~~~Johnny~~~21-Jul-07 3:27 
AnswerRe: DataSource binding problem Pin
~~~Johnny~~~21-Jul-07 5:01
~~~Johnny~~~21-Jul-07 5:01 
GeneralRe: DataSource binding problem Pin
Urs Enzler22-Jul-07 6:24
Urs Enzler22-Jul-07 6:24 
GeneralRe: DataSource binding problem Pin
~~~Johnny~~~23-Jul-07 6:03
~~~Johnny~~~23-Jul-07 6:03 
GeneralRe: DataSource binding problem Pin
Urs Enzler29-Jul-07 21:40
Urs Enzler29-Jul-07 21:40 
Questionadd header and footer to a dynamically generated word Pin
Nitin Varambally21-Jul-07 3:23
Nitin Varambally21-Jul-07 3:23 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.