Re: multi-channel download - WeOnlyDo Discussion board

Re: multi-channel download (General questions)

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


Complete thread: