Sign in to follow this  
Followers 0
Myicq

tcpconnect dependency of Telnet on Win7 ?

4 posts in this topic

I have sent to a customer a small application (compiled EXE on an XP system). The application would connect by ethernet as a client using a certain port, and send some commands.

In essense this:

; start TCP
TCPStartup()
; make a connection to port 3000
$s = TCPConnect($g_IP, "3000")
; send a command
; do not need to wait for reply from server in this example
tcpsend($s, "CMD#")
; close connection
TCPCloseSocket($s)
; shutdown TCP
TCPShutdown()

The customer complianed about constantly getting "ERROR: 10060 when connecting".

This is a timeout, which normally comes when server is not available.

Then the customer installed / activated Telnet in Win7 (http://www.fettesps.com/windows-7-enable-telnet/)

And it worked...

So my questions are:

1) does tcp() functions really depend on Telnet being activated / installed ? I thought they were lower-level, and telnet just another application.

2) if so, how can I programmatically check if the correct functionality is there ?

Perhaps this question is more Windows than AutoIT. But I would like to avoid having the extra support on my small scripts once supplied to customers.


I am just a hobby programmer, and nothing great to publish right now.

Share this post


Link to post
Share on other sites



In Windows 7, you can use DISM to check to see if Telnet is enabled. Here is example output from running DISM. NOTE: it requires running elevated, and the results are not returned instantly, takes about 10-20 seconds.

C:windowssystem32>DISM /ONLINE /GET-FEATUREINFO /FEATURENAME:TelnetClient

Deployment Image Servicing and Management tool
Version: 6.1.7600.16385

Image Version: 6.1.7601.17514

Feature Information:

Feature Name : TelnetClient
Display Name : Telnet Client
Description : Connect to remote computers by using the Telnet protocol
Restart Required : Possible
State : Disabled

Custom Properties:

(No custom properties found)

The operation completed successfully.

So if the "State" is Disabled, then you can run your command to install the TelnetClient feature. DISM is included in the OS already... in fact you can also enable features with DISM as well and not just pkgmgr.exe.

Share this post


Link to post
Share on other sites

@Tripredacus : Thanks for that technical background info. I will have to look up on that tool.

But still did not find out, is the AutoIT3 version of TCPConnect() depending on Win7/Telnet feature, or some library installed with that ?

Devs should be able to shed some light on this ?


I am just a hobby programmer, and nothing great to publish right now.

Share this post


Link to post
Share on other sites

If you look at the helpfile fr TCPConnect, you'll notice that @error comes from WSAGetError. So it is using the Windows API calls.

WSAConnect on MSDN:

http://msdn.microsoft.com/en-us/library/windows/desktop/ms741559%28v=vs.85%29.aspx

It even notes that for Vista and higher to do something else, this may be related to the difference with XP you found:

For applications targeted to Windows Vista and later, consider using the WSAConnectByList or WSAConnectByName function which greatly simplify client application design.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0