Dart Home | PowerTCP Telnet for .NET | Custom Development | Reply | PowerTCP Telnet for .NET Topics | Forums |
Author | Forum: PowerTCP Telnet for .NET Topic: Timeout issue trying to use the sample code |
edowney eric.downey@state.de.us From: Newark, DE USA Posts: 17 Member Since: 10/28/09 |
posted February 8, 2013 2:21 PM Hi, I'm trying to telnet to our linux server via the AutomatedWeb4.0 example. Everything compiles fine and looks good but when I submit the page I get the error: Unable to read data from the transport connection: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. Our linux server is a little slow to bring up the login prompt - probably around 10 - 15 seconds. In our very old version of this product we set the Telnet.ReceiveTimeout and Telnet.ConnectTimeout to 30000000 and that seemed to solve the problem. We're not in the midst of upgrading our code to work with the latest version and it seems that things have changed quite a bit since v1. |
Nick B (Admin) From: Utica, NY USA Posts: 619 Member Since: 05/25/10 Extra Support Options Custom Application Development |
posted February 8, 2013 2:43 PM Hello, Telnet.SocketOption.ReceiveTimeout is used to configure the read timeout before establishing a connection, and Telnet.Socket.ReceiveTimeout is used to configure the read timeout for active connections. The ConnectTimeout was removed, as the .NET Framework does not provide a connect timeout. |
edowney eric.downey@state.de.us From: Newark, DE USA Posts: 17 Member Since: 10/28/09 |
posted February 8, 2013 4:04 PM Awesome - thanx! I just tried what you suggested however the telnet1's Socket is null so it bombs when I try to assign ReceiveTimeout. |
Nick B (Admin) From: Utica, NY USA Posts: 619 Member Since: 05/25/10 Extra Support Options Custom Application Development |
posted February 8, 2013 5:13 PM Hello, I'm sorry, does this mean that your question is resolved? |
edowney eric.downey@state.de.us From: Newark, DE USA Posts: 17 Member Since: 10/28/09 |
posted February 11, 2013 8:35 AM No, it means the program still bombs because telnet1's Socket is null. What should telnet1's Socket me be initiated to? Since it's null I can't assign ReceiveTimeout. |
Nick B (Admin) From: Utica, NY USA Posts: 619 Member Since: 05/25/10 Extra Support Options Custom Application Development |
posted February 11, 2013 9:08 AM Hello, Telnet.SocketOption.ReceiveTimeout is used to configure the read timeout before establishing a connection. Socket is null before establishing a connection, and returns the Socket object the connection uses after a connection is established. |
edowney eric.downey@state.de.us From: Newark, DE USA Posts: 17 Member Since: 10/28/09 |
posted February 11, 2013 10:42 AM Ah, ok so I don't set the telnetModel.Telnet.Socket.ReceiveTimeout then. I did set the telnetModel.Telnet.SocketOption.ReceiveTimeout = 30000000 but I still get the following error message: Unable to read data from the transport connection: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. With the v1 of the telnet software I had to set the timeout to something huge because it takes about 10 seconds for our unix host to come back with the login prompt. |
Nick B (Admin) From: Utica, NY USA Posts: 619 Member Since: 05/25/10 Extra Support Options Custom Application Development |
posted February 11, 2013 11:08 AM Hello, Can you send in connection details for your server into support@dart.com so we can test against it? (if the server is exposed) Is the exception thrown on Telnet.Connect() or on Telnet.Login()? How long does it take for this exception to be thrown after the method it is thrown on is called? |
edowney eric.downey@state.de.us From: Newark, DE USA Posts: 17 Member Since: 10/28/09 |
posted February 11, 2013 11:24 AM I'm using the AutomatedWeb.40 example code. Just trying to see how to make a connection with the new version (we upgraded from v1). I tried it initially and got the error message from my previous post. So I started asking about extending the timeout which we had to do with the v1 as well so I wasn't surprised when it failed. The only thing I added to the example code was telnetModel.Telnet.SocketOption.ReceiveTimeout = 30000000; in the cmdLogin_Click |
edowney eric.downey@state.de.us From: Newark, DE USA Posts: 17 Member Since: 10/28/09 |
posted February 11, 2013 11:25 AM forgot - it's failing on the telnetModel.Execute(null); |
Nick B (Admin) From: Utica, NY USA Posts: 619 Member Since: 05/25/10 Extra Support Options Custom Application Development |
posted February 11, 2013 11:58 AM Hello, TelnetModel.Execute() does a lot; what Telnet method is the exception thrown on? (configure Visual Studio to break on all thrown exceptions) (did you set telnetModel.Telnet.SocketOption.ReceiveTimeout = 30000000; before the call to telnetModel.Execute(null);?) |
edowney eric.downey@state.de.us From: Newark, DE USA Posts: 17 Member Since: 10/28/09 |
posted February 11, 2013 12:17 PM Yeah, I assigned the ReceiveTimeout on the line prior to the execute. Wow, didn't realize execute had some code I could step through. I see where it's changing the ReceiveTimeout so that's a problem. I'll comment that out and see where I am after that as well as get a better idea of where it's actually failing. |
edowney eric.downey@state.de.us From: Newark, DE USA Posts: 17 Member Since: 10/28/09 |
posted February 11, 2013 1:01 PM ok, stepped through the code and got the following exception thrown: Unable to read data from the transport connection: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. Go that from the Telnet.Login in the Connect method of TelnetModel. I had previously replaced the 5000 in the ReceiveTimeout a few lines above with 300000 |
Nick B (Admin) From: Utica, NY USA Posts: 619 Member Since: 05/25/10 Extra Support Options Custom Application Development |
posted February 11, 2013 1:52 PM Hello, Have you tried changing the Credentials.PromptTimeout? (Argument for Telnet.Login()) Please try the included Winform Telnet Client sample, and connect to your server without specifying the username and password. This will allow you to enter your username and password interactively in the sample (doesn't use Login()). Is there any exception? |
edowney eric.downey@state.de.us From: Newark, DE USA Posts: 17 Member Since: 10/28/09 |
posted February 11, 2013 2:50 PM Yay, one hurdle over come. It's connecting and logging in which is great but here's the error message I'm getting now: delhost (Linux release 2.6.18-92.el5 #1 SMP Tue Apr 29 13:16:15 EDT 2008) (5) login: tsgapps Password: Last login: Mon Feb 11 14:36:14 from 172.24.13.12 [$]Exception Thrown: The command prompt was not found. Looks like it can't find the [$] which I put in as my command prompt. Bu, like I said, making progress - that's good... |
edowney eric.downey@state.de.us From: Newark, DE USA Posts: 17 Member Since: 10/28/09 |
posted February 12, 2013 8:19 AM I traced the error to line #88 in TelnetModel.cs where it says: if (_data.Delimeter != null) Why's it checking against the delimiter property? It contained the ascii values of the delimiter I assigned to the Credentials.CommandPrompt. |
Nick B (Admin) From: Utica, NY USA Posts: 619 Member Since: 05/25/10 Extra Support Options Custom Application Development |
posted February 12, 2013 8:51 AM Hello, This was fixed in our latest kit release, which may be downloaded here: http://www.dart.com/downloads/PowerTCP_Telnet_44.msi A list of the changes in this release are available here: http://www.dart.com/pttelnet_relhist.aspx |
edowney eric.downey@state.de.us From: Newark, DE USA Posts: 17 Member Since: 10/28/09 |
posted February 12, 2013 9:11 AM I'm currently running v4.4.3.1 of Dart.Telnet Doesn't that have the fix in it? I just installed the msi you linked to the other day (had to due to my desktop being reimaged). |
Nick B (Admin) From: Utica, NY USA Posts: 619 Member Since: 05/25/10 Extra Support Options Custom Application Development |
posted February 12, 2013 9:38 AM Hello, The latest version is 4.4.5.1. This fix isn't in the control, it's in the sample, but the latest version also includes some other fixes. This version was released in November of last year. |
Nick B (Admin) From: Utica, NY USA Posts: 619 Member Since: 05/25/10 Extra Support Options Custom Application Development |
posted February 12, 2013 9:39 AM Also, what link are you referring to that I linked to the other day? |
edowney eric.downey@state.de.us From: Newark, DE USA Posts: 17 Member Since: 10/28/09 |
posted February 12, 2013 9:57 AM When I went download the msi you had listed the file name was the same as the one I downloaded back in September so I assumed they were the same but now that I'm installing the file from the link you sent me. I see it's a newer version than the one I'm currently using. I'll get back to you shortly with a status... |
edowney eric.downey@state.de.us From: Newark, DE USA Posts: 17 Member Since: 10/28/09 |
posted February 12, 2013 10:27 AM Ok, I'm back. I installed the msi you linked to above and opened up the TelenetSample.CS40 solution in VS2010. Ran the AutomatedWeb.40 project and got the following error message. Made sure I could manually telnet into the host which worked fine so I modified line 116 in TelnetModel.cs from 5000 to 90000 and added 'Telnet.SocketOption.ReceiveTimeout = 90000;' right above the Telnet.Connect. Still got the same error message on the Telnet.Login on line 130. Here's the message: Dart.Telnet.DataException: Exception thrown before finding specified delimiter(s). ---> System.IO.IOException: Unable to read data from the transport connection: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. ---> System.Net.Sockets.SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags) at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size) --- End of inner exception stack trace --- at 1.2.Read(Byte[] buffer, Int32 offset, Int32 count) at 1.0.Read(Byte[] buffer, Int32 offset, Int32 count) at 1.7.Read(Byte[] buffer, Int |
Nick B (Admin) From: Utica, NY USA Posts: 619 Member Since: 05/25/10 Extra Support Options Custom Application Development |
posted February 12, 2013 11:18 AM Hello, What resolved this the previous time? Was it changing the Credentials.PromptTimeout? |
edowney eric.downey@state.de.us From: Newark, DE USA Posts: 17 Member Since: 10/28/09 |
posted February 12, 2013 11:34 AM Good catch! I completely forgot about that one. Yep that did it. Looks like I'm working - thanks for all of your help. I'm going to start looking at using ssl as I think that's what the vendor said the reason was for the slow connect time. But that will have to be another thread ;) |
Reply | PowerTCP Telnet for .NET Topics | Forums |
This site is powered by PowerTCP WebServer for ActiveX |