PDA

View Full Version : How To Specify Telnet.Connect Timeout


styles
11-18-2008, 02:42 PM
When attempting to connect to a server that doesn't exist it takes around 15-20 seconds for Telnet.Connect() to throw an exception. Is there anyway to specify the amount of time to wait during a connection attempt before timing out? I'm connecting to multiple servers and waiting 20 or so seconds is too long.

Setting the Telnet.Timeout parameter does not have any effect when connecting.

I can't tell if it's a case of poor documentation with the .NET Telnet component
[see /telnetfactorydotnet/docs/api/html/Jscape.Telnet.Telnet.Timeout.html/]

but it seems as if the java version supports this
[see /sshfactory/docs/javadoc/com/jscape/inet/telnet/Telnet.html#setTimeout(int)]

prepend the jscape website to the links above. The forum would not let me paste the proper links.

mjawwad
11-19-2008, 04:32 AM
Please post the stacktrace of the exception you are receiving.

Regards,

Mohammad Jawwad
JSCAPE
Your source for Java and .NET Internet components.

styles
11-19-2008, 01:29 PM
I don't know why you need the trace, as the exception is valid.

My question is, that when attempting to connect to a server that is not responding (imagine you enter the wrong IP address and try to establish a connection)
how can I specify the amount of time to wait before timing out? By default it is in the 15-20 second range. I want to make it shorter.

If I were using vanilla async Sockets I would simlpy create a timer and close the socket if it did not connect within my specified time, but using the Telnet component I cannot do that.

The Jscape.Telnet.Telnet.Timeout property has no effect when establishing a connection.

The stack trace is:

System.Net.Sockets.SocketException
at Jscape.Telnet.Telnet.Connect()

Message is:

"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 192.168.11.4:23"

ErrorCode: 10060

SocketErrorCode : TimedOut

mjawwad
11-20-2008, 04:55 AM
This has been marked as a bug for the .NET API. It will be taken notice of in the next release of the API.

Best Regards,