You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by "Fischer, Till" <Ti...@neusoft.com> on 2011/09/28 16:07:06 UTC

[NET - Telnet] Second execution of task hangs forever.

Hello all,

I'm trying to remote control an embedded system using telnet. The system is running QNX (A realtime Unixoid).
The first connection with telnet works without any problem. But the second hangs forever.
I prepared a minimal working (or rather not working) example:

=========================================================================================
<project name="test" basedir="." default="telnet2">

	<target name="telnet2" depends="telnet1">	
		<telnet server="192.168.118.130" userid="root" password="root" timeout="5">
		<read>#</read>
		<write echo="true">ls</write>
		</telnet>
	</target>
	
	<target name="telnet1">
		<telnet server="192.168.118.130" userid="root" password="root">
		<read>#</read>
		<write echo="true">ls</write>
		</telnet>
		<echo message="sleeping 2s"/>
		<sleep seconds="2"/>
		<echo message="slept 2s"/>
	</target>
</project>
=========================================================================================
If I execute this I get the following output from ant:

=========================================================================================
C:\tmp>ant
Buildfile: C:\tmp\build.xml

telnet1:
   [telnet]
   [telnet]
   [telnet] QNX Neutrino (localhost) (ttyp0)
   [telnet]
   [telnet]
   [telnet]
   [telnet] login:
   [telnet] root
   [telnet]  Password:
   [telnet]
   [telnet] Wed Sep 28 15:00:20 2011 on /dev/ttyp0
   [telnet] Last login: Wed Sep 28 14:59:24 2011 on /dev/ttyp0
   [telnet] #
   [telnet] ls
     [echo] sleeping 2s
     [echo] slept 2s

telnet2:
Batchvorgang abbrechen (J/N)? J

C:\tmp>
=========================================================================================

The second telnet task hung for more than five minutes (note the 5s timeout specified).

On the remote systems side I looked for the connection using netstat. It was there during the first task execution. Then gone afterwards, and another connection was made for the second execution.
So I verified, that the first connection is properly closed, at least on the remote system.

Does anybody know of this problem? Can you give me any directions to further investigate?
I am writing in the hopes of not having to dig into the commons-net source code and debugging it myself.

Best regards
Till

--
Till Fischer
Software Engineer
Software Release Management

Neusoft Technology Solutions GmbH
Hugh-Greene-Weg 2-4
22529 Hamburg - Germany

Mailto: till.fischer@neusoft.com
www.neusoft.com


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org