c# client bandwith-test chart (2)

Hello everybody !!

Sorry for my normal english.

I develop an application in c# by means of library tik4net.

I would like to make un bandwidth-test like in winbox.
My code :

private void button_graphStart_Click(object sender, EventArgs e)
{

TikSession mks = new TikSession(TikConnectorType.Api);
mks.Open(textBox1_address.Text, textBox1_login.Text, textBox1_passwd.Text);
IApiConnector apiConnector = (IApiConnector)mks.Connector; //!!! MOST important row in sample

List macScanList = apiConnector.ApiExecuteReader(“/tool/bandwidth-test”,
new Dictionary<string, string>

{
{“address”,““},
{“user”,”
“},
{“password”,”
*”}
{“duration”,“10”}



});


List adtata = new List();



foreach (ITikEntityRow row in macScanList)
{
adtata.Add(row.GetStringValueOrNull(“rx-current”, true));


}
foreach (string val in adtata)
{
chart_BandwitdhTest.Series[“RX”].Points.AddY(val);

}


}


But when i click on start button my client is blocked.

I would like to read the values and the posted on my graph at the same time but the I read then I post during a laps of time with the parameters duration.


thanks for your help

You’ll need to look into threading.

Make the receiving happen on one thread (a producer), and make the drawing in another thread (a consumer).

thanks for your answer i’am going to see that.

I saw threading.


That answers the problem .

But i have a other problem.

I want to make a bandwitdh test like in winbox :

When i push button start i want to see in my client the chart with values and when i push stop my chart stop .

Not stock values in variable then i plot in my graph.

idea?please

I’d guess that merely stopping the producer thread should do it. Either that, or perhaps in the consumer thread, you could add a condition that, upon seeing the “stock” value (“null”, right?) will not draw a point on the graph.

stock is not a variable!!!

i see that thanks.