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: WaitFor Error (An established connection was aborted by the software ...)
mbonacia
mbonacia@yahoo.com

From: Miami, FL USA
Posts: 8
Member Since: 04/27/06
posted April 27, 2006 10:40 AM

I connect to an equipment to obtain it's configuration through a telnet process. I connect ok, send the userid and pwd, no problems there, wait for certain data that tells me I'm at the prompt (using the telnet.waitfor method), then I send a retrieve command (to get the info I'm looking for). Immediately after I send this command I wait for a message that indicates that it finish the retrieval (msg = "/* records retrieved*/"). At this command (telnet.waitfor("retrieved */") is where I get the following error:

An established connection was aborted by the software in your host machine

I'm using VB.NET 2003, .NET framework 2.0 (v2.0.50727) and Dart Telnet Component 1.0.3.0, runtime v1.1.4322.

Any help will be much appreciated, thanks!
Tony Priest



From: Utica, NY USA
Posts: 8466
Member Since: 04/11/00
posted April 27, 2006 5:11 PM

Does the error occur immediately after you call WaitFor?
Or does it take a few seconds?
What did you set Telnet.ReceiveTimeout to?
Have you tried using the Trace event to see the actual data that is being sent and received?
mbonacia
mbonacia@yahoo.com

From: Miami, FL USA
Posts: 8
Member Since: 04/27/06
posted April 27, 2006 6:21 PM

happens immediately after the waitfor. Receive, send and connect timeout were set to 5000 then to 10000 giving me same result. Used trace events, and I see the data received once I login to the equipment (1st time use the wait for) but when I send the command to retrieve and wanted to wait for the string that indicatges it finished ("retrieved */") I get the error. I'm using the telnet emulation control to parse the data received from the telnet control (to eliminate the control chars from the telnet). Here is the function where the error is ocurring:

  Private Function SendAndWait(ByVal penmEquip As EquipmentType, ByVal pstrSendData As String, ByVal pstrPrompt As String, Optional ByRef pstrTransData As String = "") As Boolean
   On Error GoTo LOCAL_ERRHANDLER

   Dim strData As String
   Dim blFail As Boolean
   Dim strResult As String

   blFail = False

   vtTelnetTerminal.Clear()
   vtTelnet.Send(pstrSendData + ControlChars.CrLf)
' here is when the error occurrs
'*******
   strData = vtTelnet.WaitFor(pstrPrompt)
'*******
   vtTelnetTerminal.Write(strData)
   strResult = ProcessData(penmEquip, vtTelnetTerminal.ScrapeText(0, (vtTelnetTerminal.BufferRows + vtTelnetTerminal.ScreenSize.Height) * (vtTelnetTerminal.ScreenSize.Width + 2)))
   If strResult = "-1" Then 'error when processing the data
     blFail = True
   Else
     pstrTransData += strResult '& ControlChars.CrLf
   End If

LOCAL_EXIT:
   On Error Resume Next
   SendAndWait = Not blFail
   Exit Function

LOCAL_ERRHANDLER:
   blFail = True
   Call InsertLog("ERROR - SendAndWait:" & Err.Description & " (" & Err.Number & ")")
   Diagnostics.Debug.WriteLine("ERRORR - SendAndWait:" & Err.Description & " (" & Err.Number & ")")
   Resume LOCAL_EXIT
   Resume
  End Function
Tony Priest



From: Utica, NY USA
Posts: 8466
Member Since: 04/11/00
posted April 27, 2006 6:31 PM

What happens if you login interactively using the sample client, then type the command?
mbonacia
mbonacia@yahoo.com

From: Miami, FL USA
Posts: 8
Member Since: 04/27/06
posted April 28, 2006 9:15 AM

Tony, I used the emulation sample and worked fine. Immediately ran the app and got the same.

btw, thanks for your assistance
Tony Priest



From: Utica, NY USA
Posts: 8466
Member Since: 04/11/00
posted April 28, 2006 9:29 AM

Are you saying that you are all set now? Or do you still need help?
mbonacia
mbonacia@yahoo.com

From: Miami, FL USA
Posts: 8
Member Since: 04/27/06
posted April 28, 2006 9:31 AM

I'm sorry for the confusion. I meant to say that "got the same error as before". I'm still having having troubles.
Tony Priest



From: Utica, NY USA
Posts: 8466
Member Since: 04/11/00
posted April 28, 2006 9:39 AM

Then compare the trace from the one that works to the one that doesn't and see what is different.
mbonacia
mbonacia@yahoo.com

From: Miami, FL USA
Posts: 8
Member Since: 04/27/06
posted April 28, 2006 9:44 AM

Did that already, the trace is pretty much the same, one is an automated process and the other one is a manual one. It connects fine, using the waitfor once to confirm that I logged in successfully, then I send a retrieve command (which I get to see in the trace along with the previous login information) and immediately after I call the waitfor to wait until the retrieve command finishes. As soon as I get to the line waitfor it raises the error.
Tony Priest



From: Utica, NY USA
Posts: 8466
Member Since: 04/11/00
posted April 28, 2006 10:02 AM

Remove the WaitFor after the command and just call Receive and see what happens.
mbonacia
mbonacia@yahoo.com

From: Miami, FL USA
Posts: 8
Member Since: 04/27/06
posted April 28, 2006 11:26 AM

the receive does not generate any erros, but does not work the same as the waitfor.
Tony Priest



From: Utica, NY USA
Posts: 8466
Member Since: 04/11/00
posted April 28, 2006 11:34 AM

Ok, now try calling receive in a loop, buffering up the data that you receive, until the data contains pstrPrompt and see if that works.
mbonacia
mbonacia@yahoo.com

From: Miami, FL USA
Posts: 8
Member Since: 04/27/06
posted April 28, 2006 12:06 PM

while looping, it errors out on the second receive call. here is the code:

   blExit = False
   vtTelnet.Send(pstrSendData + ControlChars.CrLf)
   Do While Not blExit
     'strData = vtTelnet.WaitFor(pstrPrompt)
     strBuffer = vtTelnet.Receive.ToString
     strData += strBuffer
     If InStr(1, strBuffer, pstrPrompt) > 0 Then blExit = True
   Loop
   vtTelnetTerminal.Write(strData)


1st time in the loop I get something on the buffer, the second time it loops raises the error. It appears like the connection drops for some reason.
Tony Priest



From: Utica, NY USA
Posts: 8466
Member Since: 04/11/00
posted April 28, 2006 1:11 PM

What is the value of strData after the call to Receive?
How does a trace using this method compare to the other one?
mbonacia
mbonacia@yahoo.com

From: Miami, FL USA
Posts: 8
Member Since: 04/27/06
posted May 1, 2006 9:15 AM

the trace is the same as with the waitfor, the value of strdata is the remaining of the string after the 1st waitfor. I call waitfor the 1st time for "ACO" which is one piece of the string that indicates that I'm connected and logged to the equipment. After the ACO you will see time and date. That message (ACO Time & Date) is what strData has after I call the receive the 1st time.
Tony Priest



From: Utica, NY USA
Posts: 8466
Member Since: 04/11/00
posted May 2, 2006 5:30 PM

Is there any way I can get access to the system to try and see what's happening for myself? From what I can tell you have standard support, so you may as well email us directly to resolve this issue. If you send an email to support@dart.com with the subject "More info on topic 6782" it will find it's way back to me.

Ideally I would like you to send a really simple project that I can run here so that I am using the exact code that you are.
Reply | PowerTCP Telnet for .NET Topics | Forums   
This site is powered by PowerTCP WebServer Tool PowerTCP WebServer for ActiveX