I've quickly incorporated the Port attribute as you suggested, plus any other changes I made since the last patch to streamline its operation (e.g. a change to cope with servers that echo commands to the output). I've put your suggestions into the Javadoc comment at the beginning, and the code is littered with various suggestions on things that could/should be improved. However, it is working very happily for me with a number of remote telnet hosts.
I'm not too familiar with Telnet, but I would hope that there might be more elegant ways around issues with identifying prompts and confirming that commands have completed. But in the absence of these I think that there may be some difficulty combining the specifics of making a remote Telnet command work in most cases with some of your suggestions of making it more generic for use with protocols which sit on top of Telnet. Oh, finally, I've moved it into the optional tasks. Hope this looks okay, Stuart. Index: defaults.properties =================================================================== RCS file: /home/cvspublic/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/defaults.properties,v retrieving revision 1.49 diff -u -r1.49 defaults.properties --- defaults.properties 2000/11/06 12:35:14 1.49 +++ defaults.properties 2000/11/06 16:09:34 @@ -67,6 +67,7 @@ propertyfile=org.apache.tools.ant.taskdefs.optional.PropertyFile depend=org.apache.tools.ant.taskdefs.optional.depend.Depend antlr=org.apache.tools.ant.taskdefs.optional.ANTLR +telnet=org.apache.tools.ant.taskdefs.optional.Telnet # deprecated ant tasks (kept for back compatibility) javadoc2=org.apache.tools.ant.taskdefs.Javadoc The new task file ant/src/main/org/apache/tools/ant/taskdefs/optional/Telnet.java is attached as a zip archive.
<<attachment: Telnet.java.zip>>
On Monday, November 6, 2000, at 03:04 PM, Stefan Bodewig wrote: > Stuart, > > you've mentioned on ant-user that you already had some changes to this > submission, could you please repost you new version? > > Improvements I would want to see: > > *) make the port number an attribute (with default 23) > > *) multiple lines of input (using a nested #PCDATA section and the > addText(String) method). > > *) Make the login/password thing customizable. This task could be used > for many protocols sitting on top of telnet, like POP3 - where there > wouldn't be any prompt (but you'd have to say USER username and > PASS password) - or even protocols without authentication. > > *) I'm not familiar with the NetComponents classes at all, can we have > something like "read a line" instead of a given prompt? This would > be useful in contexts like SMTP or NNTP. Well, maybe using expect > and JACL would be better here. > > nothing of which must be done before it gets committed (well, I'd > probably patch it to make the port customizable myself). > > Stefan > > ------------------------------------------------------------------------- Stuart Roebuck, BSc, MBA Tel.: 0131 228 4853 / Fax.: 0870 054 8322 Managing Director Alpha Numeric Pager: 07654 588898 ADOLOS http://www.adolos.com/
