login about faq

Hi, I am having trouble tuning my application. I am trying to find best possible solution how to execute commands on device, wait for output and then disconnect. Problem is sometimes getting output takes about 15-20 seconds, therefore I used also ChannelReadAndPoll command. But I see that when I set up this command to have timeout 30 seconds, It waits also around 30 seconds when it already gets all the output which is time wasting.

How can I tune the application, so when it gets all the output or a specific line faster It can disconnect.

/*THIS IS THE SET OF COMMANDS I WANT TO RUN */

              success = end_device.ChannelSendString(channelNum, command, "ansi");

              if (success != true)
              {
                    result = "Execution of commands failed";
                    return Tuple.Create(false, result);
              }

              // Wait and fetch streaming output from Device
              var cmdOutput = end_device.ChannelReadAndPoll(channelNum, 30000);
              if (cmdOutput < 0)
              {
                    result = end_device.LastErrorText;
                    return Tuple.Create(false, result);
              }

              /* SEND END OF COMMANDS */
              success = end_device.ChannelSendEof(channelNum);
              if (success != true)
              {
                    result = "Execution of commands failed";
                    return Tuple.Create(false, result);
              }

              //  After recieving output close the channel:
              success = end_device.ChannelSendClose(channelNum);
              if (success != true)
              {
                    result = end_device.LastErrorText;
                    return Tuple.Create(false, result);
              }

              if (success)
              {
                    result += end_device.GetReceivedText(channelNum, "ansi");
                    return Tuple.Create(true, result);
              }

asked Mar 07 at 11:05

marhyno's gravatar image

marhyno
34

edited Mar 07 at 11:14

Be the first one to answer this question!
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×107
×20

Asked: Mar 07 at 11:05

Seen: 592 times

Last updated: Mar 07 at 11:14

powered by OSQA