Login  
Search All Forums
Dart Home | PowerTCP Emulation for .NET | Custom Development Reply | PowerTCP Emulation for .NET Topics | Forums   
AuthorForum: PowerTCP Emulation for .NET
Topic: How to migrate event driven v1.0.3.0 app to v4.2.1.7
bobhooper

From: Ferndown, Dorset, United Kingdom
Posts: 9
Member Since: 06/08/05
posted November 1, 2010 6:17 AM

I am contemplating migrating our application from Power TCP Emulation v1.0.3.0 to the latest version, v4.2.1.7, but need some guidance before proceeding.

Our current app scrapes a formatted green-screen UNIX system and relies heavily on Telnet.AutoReceive = true, trapping the EndReceive event and interrogating Telnet.Available to determine whether there is any more data to come. Once I am confident it's all arrived I do a VT.ScrapeText, determine whereabouts in the system we are, and render a windows form for user interaction. Interactions are relayed back to the UNIX app using the Telnet.Send method.

How might I set about implementing the same functionality now that the AutoReceive property & EndReceive event are no longer available?
Mike Baldwin (Admin)



From: Rome, NY USA
Posts: 114
Member Since: 04/11/00

Extra Support Options
Custom Application Development

posted November 1, 2010 10:13 AM

Hi Bob,

Before we can recommend an optimal design, we need to know if this is a Windows Forms app, Web Forms app, service, console app, etc. Please advise.

Regards, mike
bobhooper

From: Ferndown, Dorset, United Kingdom
Posts: 9
Member Since: 06/08/05
posted November 1, 2010 10:19 AM

Hi Mike,

It's Windows Forms.

The app is currently written in VB .net (VS 2003) and we just took delivery of shiny new VS 2010.

Many thanks,

Bob
Mike Baldwin (Admin)



From: Rome, NY USA
Posts: 114
Member Since: 04/11/00

Extra Support Options
Custom Application Development

posted November 1, 2010 11:14 AM

Hi Bob,

You can model you app design after our Telnet Client (Independent). This is a Windows Forms app, and you can use the VB sample.

What's involved is simply using the Telnet.Start() method to start a worker thread (you pass it a delegate to your worker function). In your function, create a new Vt Control and perform the Telnet.Connect() and use Telnet.Read() and Telnet.Write() as you have previously done. Use Vt.Write() to populate the Vt Control with data from the host. Use Vt.ScrapeText() when you have all the data, as before. Then use Telnet.Marshal(string dataToDisplay), which will marshal your data to the UI thread (UserData event) where you can display it in your windows form for your user.

This technique is superior over the old design because all your communications is programmed synchronously in your worker function, making it really easy to debug (compared to the previous asynchronous design). It is also very efficient, and never interferes with the UI thread.

We can also perform this port for you (some customers welcome a little extra help). Just contact sales@dart.com for details. I'm glad to hear you like our products!

Regards, mike
bobhooper

From: Ferndown, Dorset, United Kingdom
Posts: 9
Member Since: 06/08/05
posted November 3, 2010 7:36 AM

Hi Mike,

We've never used Telnet.Read directly as we've relied on trapping EndReceive (in AutoReceive mode) and looked at the Available property to see if there's any more 'up the pipe'. When we thinks it's all arrived we do a ScrapeText.

The receiveData() method in the sample app looks to read for ever i.e. until the connection is closed, marshalling everything back to the UI.

How could we ascertain that all the data's arrived and that we should to a Scrapetext?

Thanks again for you help,

Bob
Mike Baldwin (Admin)



From: Rome, NY USA
Posts: 114
Member Since: 04/11/00

Extra Support Options
Custom Application Development

posted November 3, 2010 12:15 PM

Hi Bob,

Telnet.Read(string delimiter) will read up to a specific delimiter. So if you can determine a string sequence that indicates the end of your report, just use that and call Telnet.Close() once you get it.

If you can't do that, set Telnet.SocketOption.ReceiveTimeout to 1000. Make sure your Telnet.Read(byte[] buffer) is within a try{} clause and catch{} the SocketException (the socket will throw the exception after blocking for 1 second with no data available).

That should do it.

------
-Non-current subscribers must contact sales@dart.com to update subscription and receive continued support as needed.
------

Reply | PowerTCP Emulation for .NET Topics | Forums   
This site is powered by PowerTCP WebServer Tool PowerTCP WebServer for ActiveX