Login  
Search All Forums
Dart Home | PowerTCP Telnet for .NET | Custom Development Reply | PowerTCP Telnet for .NET Topics | Forums   
AuthorForum: PowerTCP Telnet for .NET
Topic: DisplayData(Telnet1.WaitFor("$")) -C Sharp
xplorer2k

From: Oxnard, CA USA
Posts: 33
Member Since: 03/27/09
posted April 23, 2009 8:25 PM

Hi Everyone,

I need to display received data on a textbox using synchronous communication. On PowerTCP Telnet prior to version 4.0 I used the following code to display received data: DisplayData(Telnet1.WaitFor("$")).

What is the equivalent command on version 4.0 (C#)?

Thanks,
xplorer2k

K M Drake



From: Utica, NY USA
Posts: 3406
Member Since: 07/14/00
posted April 24, 2009 9:09 AM

Hi,
Thanks for the question.
First, a distinction between the earlier version of Telnet and 4.0:

Synchronous operation in 4.0 are true blocking calls.
In the old Telnet, synch operations used a "pseudo-blocking" technique, which would allow events to continue firing during the blocking call.
This is no longer the case.
Therefore, if you are using the component in a Windows Forms app with a UI, I recommend using the async technique.
Otherwise, your UI will truly be blocked while the operation is taking place.

Either way, the same blocking calls are made; in this case, the Read call that waits for a prompt.
Here is a straight blocking example:

textBox1.Text = telnet1.Read($).ToString();


Here is the non-blocking example:

telnet1.Start(getPrompt, null); //operate on worker thread

private void getPrompt(Telnet telnet, object state)
{
  telnet.Marshal(telnet.Read("$")); //send data back to UI thread via Data event
}

void telnet1_Data(object sender, DataEventArgs e)
{
  textBox1.Text = e.Data.ToString();
}

For a more detailed explanation, I highly recommend reading the Asynchronous Operation page of the help file, and examining its examples.

Also, please see the Winforms Automated Client sample, which does exactly what you are asking - waits for a prompt and displays it in a textbox.

Hope it helps,
-ken
xplorer2k

From: Oxnard, CA USA
Posts: 33
Member Since: 03/27/09
posted April 24, 2009 12:34 PM

Thanks Ken,

xplorer2k
chitranggolvelker

From: Los Angeles, CA USA
Posts: 13
Member Since: 11/23/10
posted November 30, 2010 3:01 PM

Hi,
I am new to this tool as well as technology. I know its a very old thread but I am having a similar issue while reading the data received from Telnet. I am using Emulation for .Net to connect to a Telnet server. Inside this Telnet session I am connecting to a system which is sending all the data via Telnet.
My issue is after each .Write method call I am getting around 10-15 lines in response, now I need to be able to read this response and then send my next request. I see the sample showing the way to read "$" prompt or ":" prompt and then sending the next .Write command. In my case where there are many lines to read what I should look for in the Read command and go to the next Write statement.
Here is one sample of the result that I get after sending one Write command.

On sending an Enter key I get this response, now this text will always be same, so what should I look for in the Read command before executing another Write command?
*********************************************
--Sent-> /13/0
<-Recv-- <ESC>[?25l
<-Recv-- <ESC>[3;11H<ESC>[m<ESC>[30m<ESC>[47m                             <ESC>[4;11H                             <ESC>[5;11H                             <ESC>[6;11H                             <ESC>[7;11H                             <ESC>[8;11H                             <ESC>[9;11H                             <ESC>[10;11H                             <ESC>[11;11H                             <ESC>[12;11H                             <ESC>[13;11H                             <ESC>[14;11H                             <ESC>[15;11H                             <ESC>[16;11H                             <ESC>[17;11H                             <ESC>[18;11H          
<-Recv--                    <ESC>[19;11H                             <ESC>[20;12H                             <ESC>[1;1HCAIUSA<ESC>[1;25HCarol Anderson By Invitation<E
Nick B (Admin)

From: Utica, NY USA
Posts: 619
Member Since: 05/25/10

Extra Support Options
Custom Application Development

posted November 30, 2010 3:27 PM

Hello,

You should Read() for whatever character or string (can be more than one character) that signals when you'd want to stop reading. For most people, this is a command prompt like '$:'. If this is not enough to help, please provide the formatted output, and I will examine it for an acceptable delimiter. It may be useful to use the included Telnet Client sample to get this.
chitranggolvelker

From: Los Angeles, CA USA
Posts: 13
Member Since: 11/23/10
posted November 30, 2010 4:07 PM

--Sent-> /13/0
<-Recv-- <ESC>[?25l
<-Recv-- <ESC>[19;11H <ESC>[20;12H <ESC>[1;1HCAIUSA<ESC>[1;25HCarol Anderson By Invitation<ESC>[1;60HCAIYF   ttyp8<ESC>[20;35H(c)2000-2009 iMatrix International Inc.<ESC>[21;35H<Esc> to Logoff - Please don't 'X' Out<ESC>[22;61HRev. 5.05.04/10/13/0<ESC>[37m<ESC>[40m<ESC>[J<ESC>[30m<ESC>[47m Esc F5 <ESC>[24;1H Exit Specl <ESC>[2;1H<ESC>[0;1m<ESC>
Menu Header:
[36m<ESC>[44m <ESC>[2;3H1.Dst Svc<ESC>[2;3H<ESC>[33m1<ESC>[2;14H<ESC>[36m2.Inventory<ESC>[2;14H<ESC>[33m2<ESC>[2;27H<ESC>
chitranggolvelker

From: Los Angeles, CA USA
Posts: 13
Member Since: 11/23/10
posted November 30, 2010 4:09 PM

Hi Nick,
Sorry I forgot to thank you first for replying to my initial post.
I hope the information I have included here is what you were expecting. If not please let me know.

Thanks once again.
Chitrang Golvelker
Nick B (Admin)

From: Utica, NY USA
Posts: 619
Member Since: 05/25/10

Extra Support Options
Custom Application Development

posted November 30, 2010 4:48 PM

Hello,

I'm sorry, I meant to ask for the interpreted output, as would be seen in the emulator. Unless you can provide me access to your server?
chitranggolvelker

From: Los Angeles, CA USA
Posts: 13
Member Since: 11/23/10
posted November 30, 2010 4:54 PM

Hi Nick,
Thanks for getting back soon. I am not sure and I think it wont be possible for me to get you the access to this server but could you please instruct me how to get this interpreted output? I am using TelnetClientIndependent project and opening the Debug Session window to get the output data, please let me know what do I need to do to get a different output. The following event is being used by the project to get this output:

private void telnet1_Log(object sender, Dart.Common.LogEventArgs e)
{
 //Pass data to the debug window
 frmDebug.Write(e.Data, e.Data.Direction);
}

Thanks,
Chitrang Golvelker
Nick B (Admin)

From: Utica, NY USA
Posts: 619
Member Since: 05/25/10

Extra Support Options
Custom Application Development

posted November 30, 2010 5:16 PM

The information as it's displayed in the VT control, not the raw information from the log. You can copy it by selecting the text with the cursor and selecting copy from the edit menu.
chitranggolvelker

From: Los Angeles, CA USA
Posts: 13
Member Since: 11/23/10
posted November 30, 2010 5:34 PM

Hi Nick,

Is there a way I can send you a couple of screenshots, just to show that what I see in the run window. Actually what I see in the run window is the dropdown menus being opened and options being selected, as if running a different system inside the run window. This way I do not see the raw data in the window and which is why I wont be able to select it using the cursor. Please let me know if you have an email id where I can send the screenshots so you can relate it to the raw log I have been sending you.

Thanks,
Chitrang Golvelker
Nick B (Admin)

From: Utica, NY USA
Posts: 619
Member Since: 05/25/10

Extra Support Options
Custom Application Development

posted December 1, 2010 8:46 AM

Oh, I didn't realize it was a system like that. Yes, please send in an email to support@dart.com - I will make sure I get it.
chitranggolvelker

From: Los Angeles, CA USA
Posts: 13
Member Since: 11/23/10
posted December 1, 2010 2:01 PM

Hi Nick,

Thanks for providing me the email id, I have sent you the details and screenshot of my program.

I also have one more question, is there a limit on number of responses or questions for any subscriptions of the PowerTCP product?

Thanks & Regards,
Chitrang Golvelker
Jamie Powell (Admin)

From: Rome, NY USA
Posts: 448
Member Since: 03/13/07

Extra Support Options
Custom Application Development

posted December 1, 2010 3:20 PM

Email/forum support for any customer with an active subscription is unlimited. You may be required to upgrade your support level if a priority response is required or custom development services requested.

Please contact sales@dart.com to find out more about these upgrade options.

Thank you.

chitranggolvelker

From: Los Angeles, CA USA
Posts: 13
Member Since: 11/23/10
posted December 1, 2010 3:24 PM

Hi Jamie,

Thanks for the updates. I will keep that in mind.

Thanks & Regards,
Chitrang Golvelker
chitranggolvelker

From: Los Angeles, CA USA
Posts: 13
Member Since: 11/23/10
posted December 1, 2010 5:53 PM

Hi Nick,

I have sent you the logs as you requested. Please let me know if you need any further details from my side.

Thanks & Regards,
Chitrang Golvelker
Nick B (Admin)

From: Utica, NY USA
Posts: 619
Member Since: 05/25/10

Extra Support Options
Custom Application Development

posted December 2, 2010 11:04 AM

We've received your email, I'll reply when we have more information.
Reply | PowerTCP Telnet for .NET Topics | Forums   
This site is powered by PowerTCP WebServer Tool PowerTCP WebServer for ActiveX