multi-channel download - WeOnlyDo Discussion board

multi-channel download (wodHttpDLX)

by teddy1969, Thursday, September 15, 2005, 11:14 (6807 days ago)

Hi,

I found your wodHttpDLX and I love it! Great work! This is exactly what I was searching for a long time.

I wonder if it is possible to create multiple instances of wodHTTP to be able to download on multiple channels simultaneously?

When using the OCX (in VB6) I think I'm able to load multiple wodHTTP objects by using the index property. Is this the correct way?

Could you please give me a hint to do this on the best way?

Thank you very much (and excuse my poor school english ;-) )

Best wishes

teddy1969

Re: multi-channel download

by wodSupport, Thursday, September 15, 2005, 12:32 (6807 days ago) @ teddy1969

Teddy,

yes, this is possible to put wodHttpDLX in an array. I don't know VB that much to tell you how to put OCXes in array.

However, I would suggest you use COM object instead. Since it's initialized from the code you can use any number of instances. Even more, if you use our fast notification interface instead of events (look at '7. Implements IwodHttpNotify interface' sample) then all of them will share same code.

What you need to do is initialize instance of wodHttpDLXCom, and then put it into some collection so it's alive even after variable is reused.

I suggest you try it out, and it if doesn't work then send me your code to techsupport@weonlydo.com and I'll see from there how to help.

Re: multi-channel download

by teddy1969, Thursday, September 15, 2005, 12:41 (6807 days ago) @ wodSupport

Thank you very much for your quick reply!

I'm already testing... I will report you if I have further questions.

teddy1969

Re: multi-channel download

by Dirk, Thursday, September 15, 2005, 21:11 (6807 days ago) @ teddy1969

I'm doing this within my app.

A little snippet to show how:

Dim iWodHTTP() As wodHttpDLXCom
Implements IwodHttpNotify

Then I have a function in which I create a new HTTP request

ReDim Preserve iWodHTTP(iMyIndex) As wodHttpDLXCom
Set iWodHTTP(iMyIndex) = New wodHttpDLXCom
Set iWodHTTP(iMyIndex).Notification = Me

iwodhttp(iMyIndex).url=the_URL_to_request
iwodhttp(imyIndex).GET

The iwodHTTPNotify_done event is fired when that request is done.

Re: multi-channel download

by teddy1969, Monday, September 19, 2005, 11:58 (6803 days ago) @ Dirk

Hi Dirk,

thanks for this tip! I think you store the iMyIndex in the request.tag to recognize each request in the iwodHTTPNotify_done event?

Yes, this works great.

My first try was by using a collection. But your way seems to be more economical. ;-)

Thanks again!

Best regards

Teddy

Re: multi-channel download

by Shakeeb Ahmed, Tuesday, September 11, 2007, 11:32 (6081 days ago) @ teddy1969

Hi,

I am C# 2.0 developer and I dont know VB.

Can anyone tell me how to get Index in http_done event.

Its Urgent.

Re: multi-channel download

by woddrazen, Tuesday, September 11, 2007, 11:41 (6081 days ago) @ Shakeeb Ahmed

Hi Ahmen,


I'm not so sure which index you want to get in Done Event.

Can you explain little bit more what you want to do so we can help you to resolve your problem?

Hope I helped.


Regards,
Drazen

Re: multi-channel download

by Shakeeb Ahmed, Tuesday, September 11, 2007, 13:01 (6081 days ago) @ woddrazen

hi,

this is a VB code
Private Sub http_Done(Index As Integer, ByVal ErrorCode As Long, ByVal ErrorText As String)

for the Done event it has a index argument.

but when i do same in C# i got error delegate argument list mis-matched.

Hi Ahmen,


I'm not so sure which index you want to get in Done Event.

Can you explain little bit more what you want to do so we can help you to resolve your problem?

Hope I helped.


Regards,
Drazen

Re: multi-channel download

by woddrazen, Tuesday, September 11, 2007, 13:07 (6081 days ago) @ Shakeeb Ahmed

Oleg,


Are you using Fast notification interfaces in C#?


Drazen

Re: multi-channel download

by Shakeeb Ahmed, Tuesday, September 11, 2007, 13:17 (6081 days ago) @ woddrazen

private void button1_Click(object sender, EventArgs e)
{
string email = , pass = ;
string url = @ http://xxxxxxxxxxxxxxxxxxxxxxxxxxxxx ;

if ((masterindex > 5 || masterindex == 0) && masterindex < acList.Count)
{
for (int i = 0; i < 5; i++)
{
// http.Index = i;
email = this.listView1.Items.SubItems[0].Text;
pass = this.listView1.Items.SubItems[1].Text;
http = new wodHttpDLXClass();
http.Request.FormPost.RemoveAll();
http.Request.Cookies.RemoveAll();
http.Request.UserAgent = @ Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1 ;
http.Compression = true;
http.AutoRedirect = true;
http.Done += new _IwodHttpDLXEvents_DoneEventHandler(http_done);
http.Request.FormPost.Add( Login , );
http.Request.FormPost.Add( email , email);
http.Request.FormPost.Add( password , pass);
http.Request.FormPost.Add( Submit , Submit );
http.Post(url);
this.listView1.Items.RemoveAt(i);

this.textBox1.Text += email + : + pass;
this.textBox1.Text +=
;
}
}
}

void http_done(int ErrorCode, string ErrorText)
{
//here where i want a index to know which request is done..
}

in VB6 code i see this

Private Sub http_Done(Index As Integer, ByVal ErrorCode As Long, ByVal ErrorText As String)

[quote]Oleg,


Are you using Fast notification interfaces in C#?


Drazen[/quote]

Re: multi-channel download

by wodSupport, Tuesday, September 11, 2007, 15:50 (6081 days ago) @ Shakeeb Ahmed

Can I suggest different approach? If you use fast notifications instead of events, you can use any number of instances of wodHttpDLX, just set it's Notification property to 'this' pointer, to the class that implements IwodHttpNotify interface. After that, when notification (event...) is called, you can see 'Owner' that called it.

In order to make difference between various Owners, you can use Tag property to store your custom value for each wodHttpDLX instance, and then just check Owner.Tag to see which instance that is.

Here's simple example how to use ONE instance of wodHttpDLX with fast notifications in C#. I assume you'll know what to do from here: [code]using wodHttpDLXComLib;

namespace WindowsApplication1
{
public partial class Form1 : Form, wodHttpDLXComLib.IwodHttpNotify
{
public Form1()
{
InitializeComponent();
}

public void ClientCertRequired(wodHttpDLXCom Owner)
{ }
public void Connected(wodHttpDLXCom Owner)
{ }
public void Disconnected(wodHttpDLXCom Owner, int ErrorCode, string ErrorText)
{ }
public void Done(wodHttpDLXComLib.wodHttpDLXCom Owner, int ErrorCode, string ErrorText)
{
Console.Write(Owner.Response.Body);
}
public void HeadersDone(wodHttpDLXCom Owner)
{ }
public void HostCertificate(wodHttpDLXCom Owner, ICertificate Cert, int ErrorCode, string ErrorText, ref bool Accept)
{ }
public void Progress(wodHttpDLXCom Owner, int Position, int Total)
{ }
public void Redirect(wodHttpDLXCom Owner, ref string URL, ref bool Allow)
{ }
public void StateChange(wodHttpDLXCom Owner, HttpStates OldState) { }


private void Form1_Load(object sender, EventArgs e)
{
wodHttpDLXComLib.wodHttpDLXCom Http1 = new wodHttpDLXComLib.wodHttpDLXCom();
Http1.Blocking = true;
Http1.Notification = this;
Http1.Get( http://www.weonlydo.com );

}
}
}[/code]

Kreso

Re: multi-channel download

by Shakeeb Ahmed, Tuesday, September 11, 2007, 18:00 (6081 days ago) @ wodSupport

How to use this

you can use Tag property to store your custom value for each wodHttpDLX instance

I am confused and tell me one more thing request will automatically call the notification done function or ................

reply its urgent...........

Re: multi-channel download

by wodDamir, Tuesday, September 11, 2007, 18:32 (6081 days ago) @ Shakeeb Ahmed

Ahmed,

You should use Tag Property (HttpRequest object) to store the information about the instance (I.e: an index of an instance, or anything that you will be able to use in order to differ or compare the instances).

As for your other question, the Notification Done Event will be triggered each time a method (Get, Put etc.) is executed.

Regards,
Damba

Re: multi-channel download

by Shakeeb Ahmed, Tuesday, September 11, 2007, 21:30 (6081 days ago) @ wodDamir

Hi,

This is Shakeeb Ahmed. Thanks a lot you guys are really fast like your Activex and wodSupport is good than other tech support.

Thanks Alot