属性 | 值 | 必填 |
userid | 用于登录服务器的用户ID。 | 是 |
password | 用于登录服务器的密码。 | 是 |
server | 服务器名称/地址。 | 是 |
port | 远程telnet服务器的端口号。 | 否 |
initialCR | 连接后发送cr。 | 否 |
timeout | 设置默认超时以等待响应。 | 否 |
<project name="java-ant project" default="run"> <target name="run"> <telnet userid="java" password="java123" server="localhost"> <read>/home/lidihuo</read> <write>ls</write> <read string="/home/lidihuo"/> </telnet> </target> </project>
<project name="java-ant project" default="run"> <target name="run"> <telnet userid="java" password="******" server="localhost" timeout="20"> <read>/home/lidihuo</read> <write echo="false">sleep 15</write> <read timeout="10">/home/lidihuo</read> </telnet> </target> </project>
<project name="java-ant project" default="run"> <target name="run"> <telnet port="80" server="localhost" timeout="20"> <read/> <write>GET / http/0.9</write> <write/> <read timeout="10"></HTML></read> </telnet> </target> </project>