I am working on an BIT application to download files from remote server using
C#, There are an issue related with performance, I am downloading 3 files
28Kb, 79KB, 121KB respectivly on my system(Pentium 4, RAM 512MB, DSL
connection) it is taking 15 to 25 seconds and shows 55-56 mx CPU usage but
other system with same configuration and T1 Line its taking so much time, it
is downloading these 3 files in hours and shows 100% CPU usage regularly, i
am not able to find out any solution, i have tried setting in Group Policy
and advance setting but this issue did not resolve.
could you please let me know the solution for it.
I am using following method to download those three files.
public void DownLoadFile(string GhostPath, string WebURL)
{
char ch='/';
try
{
Manager myBits = new Manager();
Job myJob = myBits.CreateJob( WebURL.Substring(WebURL.LastIndexOf(ch)+1 ));
myJob.AddFile(GhostPath,WebURL);
myJob.ResumeJob();
do
{
if(myJob.State == JobState.Connecting)
{
if(myJob.State == JobState.Transferring)
{
do
{
Resume(myJob);
}while( myJob.State==JobState.Transferring);
}
}
else if(myJob.State ==JobState.Transferring)
{
do
{
Resume(myJob);
}while( myJob.State==JobState.Transferring);
if(myJob.State==JobState.Transferred)
{
myJob.Complete();
Cursor.Current = Cursors.WaitCursor;
}
}
else if(myJob.State ==JobState.Suspended)
{
do
{
Resume(myJob);
}
while( myJob.State==JobState.Suspended);
}
else if(myJob.State == JobState.Queued)
{
do
{
Resume(myJob);
}
while( myJob.State==JobState.Queued);
}
else if(myJob.State ==JobState.Transferred)
{
myJob.Complete();
Cursor.Current = Cursors.WaitCursor;
return;
}
else if(myJob.State == JobState.Acknowledged)
{
return;
}
else if(myJob.State == JobState.Errors || myJob.State ==
JobState.TransientError )
{
myJob.Cancel();
}
}while( myJob.State != JobState.Transferred && myJob.State !=
JobState.Errors && myJob.State != JobState.TransientError && myJob.State
!=JobState.Queued);
}
catch(Exception ex)
{
MessageBox.Show(ex.ToString());
}
}