所以,我有这个使用org.apache.commons.net.telnet.TelnetClient该类的类.它尝试发送命令并读取响应.
public class AutomatedTelnetClient
{
private TelnetClient telnet = new TelnetClient();
private InputStream in;
private PrintStream out;
private String prompt = "$";
public AutomatedTelnetClient(String server, String user, String password)
{
try
{
EchoOptionHandler echoopt = new EchoOptionHandler(false, false, false, false);
telnet.addOptionHandler(echoopt);
// Connect to the specified server
telnet.connect(server, 23);
// Get input and output stream references
in = telnet.getInputStream();
out = new PrintStream(telnet.getOutputStream());
// Log the user on
readUntil("login: ");
write(user);
readUntil("Password: ");
write(password);
// Advance to a …Run Code Online (Sandbox Code Playgroud) 我正在学习http,并试图使用telnet发送我自己的http请求.
在命令提示符中,我输入:
telnet google.com 80
Run Code Online (Sandbox Code Playgroud)
结果:屏幕被清除,我看到一个闪烁的光标.1.为什么我没有看到任何关联的迹象?
现在,尝试键入一个http命令(获取index.html ...)我看到光标在我键入时向右移动,但我没有看到字母出现在屏幕上.只有空白.那是为什么?
(使用windows7 64位)