Home |
The QtTelnet class proveds an API to connect to Telnet servers, issue commands and receive replies. More...
#include <QtTelnet>
Inherits QObject.
The QtTelnet class proveds an API to connect to Telnet servers, issue commands and receive replies.
When a QtTelnet object has been created, you need to call connectToHost() to establish a connection with a Telnet server. When the connection is established the connected() signal is emitted. At this point you should call login(). The QtTelnet object will emit connectionError() if the connection fails, and authenticationFailed() if the login() failed.
Once the connection has been successfully established and you've logged in you can send control messages using sendControl() and data using sendData(). Connect to the message() signal to receive data from the Telnet server. The connection is closed with close().
You can use your own socket if you call setSocket() before connecting. The socket used by QtTelnet is available from socket().
This enum specifies control messages you can send to the Telnet server using sendControl().
Constant | Value | Description |
---|---|---|
QtTelnet::GoAhead | 0 | Sends the GO AHEAD control message, meaning that the server can continue to send data. |
QtTelnet::InterruptProcess | 1 | Interrupts the current running process on the server. This is the equivalent of pressing Ctrl+C in most terminal emulators. |
QtTelnet::AreYouThere | 2 | Sends the ARE YOU THERE control message, to check if the connection is still alive. |
QtTelnet::AbortOutput | 3 | Temporarily suspends the output from the server. The output will resume if you send this control message again. |
QtTelnet::EraseCharacter | 4 | Erases the last entered character. |
QtTelnet::EraseLine | 5 | Erases the last line. |
QtTelnet::Break | 6 | Sends the BREAK control message. |
QtTelnet::EndOfFile | 7 | Sends the END OF FILE control message. |
QtTelnet::Suspend | 8 | Suspends the current running process on the server. Equivalent to pressing Ctrl+Z in most terminal emulators. |
QtTelnet::Abort | 9 | Sends the ABORT control message. |
See also sendControl().
Constructs a QtTelnet object.
You must call connectToHost() before calling any of the other member functions.
The parent is sent to the QObject constructor.
See also connectToHost().
Destroys the QtTelnet object. This will also close the connection to the server.
See also logout().
Closes the connection to a Telnet server.
See also connectToHost() and login().
Calling this function will make the QtTelnet object attempt to connect to a Telnet server specified by the given host and port.
The connected() signal is emitted if the connection succeeds, and the connectionError() signal is emitted if the connection fails. Once the connection is establishe you must call login().
See also close().
This signal is emitted if the underlying socket implementation receives an error. The error argument is the same as being used in QSocket::connectionError()
Returns true if the window size is valid, i.e. windowSize().isValid() returns true; otherwise returns false.
See also setWindowSize().
This signal is emitted when you have been logged in to the server as a result of the login() command being called. Do note that you might never see this signal even if you have been logged in, due to the Telnet specification not requiring Telnet servers to notify clients when users are logged in.
See also login() and setPromptPattern().
This signal is emitted when you have called logout() and the Telnet server has actually logged you out.
See also logout() and login().
Sets the username and password to be used when logging in to the server.
See also setLoginPattern() and setPasswordPattern().
This signal is emitted when the login has failed. Do note that you might in certain cases see several loginRequired() signals being emitted but no loginFailed() signals. This is due to the Telnet specification not requiring the Telnet server to support reliable authentication methods.
See also login() and loginRequired().
This signal is emitted when the QtTelnet class sees that the Telnet server expects authentication and you have not already called login().
As a reply to this signal you should either call login() or logout()
See also login() and logout().
This function will log you out of the Telnet server. You cannot send any other data after sending this command.
See also login(), sendData(), and sendControl().
This signal is emitted when the QtTelnet object receives more data from the Telnet server.
See also sendData().
Sends the control message ctrl to the Telnet server the QtTelnet object is connected to.
See also Control, sendData(), and sendSync().
Sends the string data to the Telnet server. This is often a command the Telnet server will execute.
See also sendControl().
Sends the Telnet SYNC sequence, meaning that the Telnet server should discard any data waiting to be processed once the SYNC sequence has been received. This is sent using a TCP urgent notification.
See also sendControl().
Sets the expected login pattern.
The pattern is used to automatically recognize when the server asks for a username. If no username has been set, the loginRequired() signal will be emitted.
See also login().
Sets the expected login string to login.
This is an overloaded function.
Sets the expected password prompt pattern.
The pattern is used to automatically recognize when the server asks for a password. If no password has been set, the loginRequired() signal will be emitted.
See also login().
Sets the expected password prompt to pattern.
This is an overloaded function.
Sets the expected shell prompt pattern.
The pattern is used to automatically recognize when the client has successfully logged in. When a line is read that matches the pattern, the loggedIn() signal will be emitted.
See also login() and loggedIn().
Sets the expected shell prompt to pattern.
This is an overloaded function.
Set the socket to be used in the communication.
This function allows you to use your own QSocket subclass. You should call this function before calling connectToHost(); if you call it after a connection has been established the connection will be closed, so in all cases you will need to call connectToHost() after calling this function.
See also socket(), connectToHost(), and logout().
Sets the client window size to size.
The width and height are given in number of characters. Non-visible clients should pass an invalid size (i.e. QSize()).
See also windowSize() and isValidWindowSize().
Sets the client window size.
The width and height are given in number of characters.
This is an overloaded function.
Returns the QTcpSocket instance used by this telnet object.
See also setSocket().
Returns the window's size. This will be an invalid size if the Telnet server is not using the NAWS option (RFC1073).
See also setWindowSize() and isValidWindowSize().
Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies) | Trademarks | Qt Solutions |