Home | All Classes | Main Classes | Annotated | Grouped Classes | Functions |
The TQNetworkProtocol class provides a common API for network protocols. More...
#include <tqnetworkprotocol.h>
Inherits TQObject.
Inherited by TQFtp, TQHttp, and TQLocalFs.
This is a base class which should be used for network protocols implementations that can then be used in TQt (e.g. in the file dialog) together with the TQUrlOperator.
The easiest way to implement a new network protocol is to reimplement the operation*() methods, e.g. operationGet(), etc. Only the supported operations should be reimplemented. To specify which operations are supported, also reimplement supportedOperations() and return an int that is OR'd together using the supported operations from the TQNetworkProtocol::Operation enum.
When you implement a network protocol this way, it is important to emit the correct signals. Also, always emit the finished() signal when an operation is done (on success and on failure). TQt relies on correctly emitted finished() signals.
For a detailed description of the TQt Network Architecture and how to implement and use network protocols in TQt, see the TQt Network Documentation.
See also Input/Output and Networking.
When the connection state of a network protocol changes it emits the signal connectionStateChanged(). The first argument is one of the following values:
When an operation fails (finishes unsuccessfully), the TQNetworkOperation of the operation returns an error code which has one of the following values:
You should also use these error codes when implementing custom network protocols. If this is not possible, you can define your own error codes by using integer values that don't conflict with any of these values.
This enum lists the possible operations that a network protocol can support. supportedOperations() returns an int of these that is OR'd together. Also, the type() of a TQNetworkOperation is always one of these values.
This enum contains the state that a TQNetworkOperation can have.
See also TQNetworkProtocol::setAutoDelete().
If the connection can't be opened (e.g. because you already tried but the host couldn't be found), set the state of op to TQNetworkProtocol::StFailed and emit the finished() signal with this TQNetworkOperation as argument.
op is the operation that needs an open connection.
Example: network/networkprotocol/nntp.cpp.
This signal is emitted whenever the state of the connection of the network protocol is changed. state describes the new state, which is one of, ConHostFound, ConConnected or ConClosed. data is a message text.
This signal is emitted when mkdir() has been succesful and the directory has been created. i holds the information about the new directory. op is the pointer to the operation object which contains all the information about the operation, including the state, etc. Using op->arg( 0 ), you can get the file name of the new directory.
When a protocol emits this signal, TQNetworkProtocol is smart enough to let the TQUrlOperator, which is used by the network protocol, emit its corresponding signal.
This signal is emitted when new data has been received after calling get() or put(). op holds the name of the file from which data is retrieved or uploaded in its first argument, and the (raw) data in its second argument. You can get them with op->arg( 0 ) and op->rawArg( 1 ). op is the pointer to the operation object, which contains all the information about the operation, including the state, etc.
When a protocol emits this signal, TQNetworkProtocol is smart enough to let the TQUrlOperator (which is used by the network protocol) emit its corresponding signal.
This signal is emitted during the transfer of data (using put() or get()). bytesDone is how many bytes of bytesTotal have been transferred. bytesTotal may be -1, which means that the total number of bytes is not known. op is the pointer to the operation object which contains all the information about the operation, including the state, etc.
When a protocol emits this signal, TQNetworkProtocol is smart enough to let the TQUrlOperator, which is used by the network protocol, emit its corresponding signal.
This signal is emitted when an operation finishes. This signal is always emitted, for both success and failure. op is the pointer to the operation object which contains all the information about the operation, including the state, etc. Check the state and error code of the operation object to determine whether or not the operation was successful.
When a protocol emits this signal, TQNetworkProtocol is smart enough to let the TQUrlOperator, which is used by the network protocol, emit its corresponding signal.
TQFtp *ftp = TQNetworkProtocol::getNetworkProtocol( "ftp" );This returns a pointer to a new instance of an ftp implementation or null if no protocol for ftp was registered. The ownership of the pointer is transferred to you, so you must delete it if you don't need it anymore.
Normally you should not work directly with network protocols, so you will not need to call this method yourself. Instead, use TQUrlOperator, which makes working with network protocols much more convenient.
See also TQUrlOperator.
This signal is emitted whenever a file which is a child of this URL has been changed, e.g. by successfully calling rename(). op holds the original and the new file names in the first and second arguments, accessible with op->arg( 0 ) and op->arg( 1 ) respectively. op is the pointer to the operation object which contains all the information about the operation, including the state, etc.
When a protocol emits this signal, TQNetworkProtocol is smart enough to let the TQUrlOperator, which is used by the network protocol, emit its corresponding signal.
This signal is emitted if a new child (file) has been read. TQNetworkProtocol automatically connects it to a slot which creates a list of TQUrlInfo objects (with just one TQUrlInfo i) and emits the newChildren() signal with this list. op is the pointer to the operation object which contains all the information about the operation that has finished, including the state, etc.
This is just a convenience signal useful for implementing your own network protocol. In all other cases connect to the newChildren() signal with its list of TQUrlInfo objects.
This signal is emitted after listChildren() was called and new children (files) have been read from the list of files. i holds the information about the new children. op is the pointer to the operation object which contains all the information about the operation, including the state, etc.
When a protocol emits this signal, TQNetworkProtocol is smart enough to let the TQUrlOperator, which is used by the network protocol, emit its corresponding signal.
When implementing your own network protocol and reading children, you usually don't read one child at once, but rather a list of them. That's why this signal takes a list of TQUrlInfo objects. If you prefer to read just one child at a time you can use the convenience signal newChild(), which takes a single TQUrlInfo object.
When you reimplement this method it's very important that you emit the correct signals at the correct time (especially the finished() signal after processing an operation). Take a look at the TQt Network Documentation which describes in detail how to reimplement this method. You may also want to look at the example implementation in examples/network/networkprotocol/nntp.cpp.
op is the pointer to the operation object which contains all the information on the operation that has finished, including the state, etc.
Example: network/networkprotocol/nntp.cpp.
When you reimplement this method it's very important that you emit the correct signals at the correct time (especially the finished() signal after processing an operation). Take a look at the TQt Network Documentation which describes in detail how to reimplement this method. You may also want to look at the example implementation in examples/network/networkprotocol/nntp.cpp.
op is the pointer to the operation object which contains all the information on the operation that has finished, including the state, etc.
Example: network/networkprotocol/nntp.cpp.
When you reimplement this method it's very important that you emit the correct signals at the correct time (especially the finished() signal after processing an operation). Take a look at the TQt Network Documentation which describes in detail how to reimplement this method. You may also want to look at the example implementation in examples/network/networkprotocol/nntp.cpp.
op is the pointer to the operation object which contains all the information on the operation that has finished, including the state, etc.
When you reimplement this method it's very important that you emit the correct signals at the correct time (especially the finished() signal after processing an operation). Take a look at the TQt Network Documentation which describes in detail how to reimplement this method. You may also want to look at the example implementation in examples/network/networkprotocol/nntp.cpp.
op is the pointer to the operation object which contains all the information on the operation that has finished, including the state, etc.
When you reimplement this method it's very important that you emit the correct signals at the correct time (especially the finished() signal after processing an operation). Take a look at the TQt Network Documentation which is describes in detail how to reimplement this method. You may also want to look at the example implementation in examples/network/networkprotocol/nntp.cpp.
op is the pointer to the operation object which contains all the information on the operation that has finished, including the state, etc.
When you reimplement this method it's very important that you emit the correct signals at the correct time (especially the finished() signal after processing an operation). Take a look at the TQt Network Documentation which describes in detail how to reimplement this method. You may also want to look at the example implementation in examples/network/networkprotocol/nntp.cpp.
op is the pointer to the operation object which contains all the information on the operation that has finished, including the state, etc.
TQNetworkProtocol::registerNetworkProtocol( "nntp", new TQNetworkProtocolFactory<Nntp> );after which your implementation is registered for future nntp operations.
The name of the protocol is given in protocol and a pointer to the protocol factory is given in protocolFactory.
This signal is emitted when remove() has been succesful and the file has been removed. op holds the file name of the removed file in the first argument, accessible with op->arg( 0 ). op is the pointer to the operation object which contains all the information about the operation, including the state, etc.
When a protocol emits this signal, TQNetworkProtocol is smart enough to let the TQUrlOperator, which is used by the network protocol, emit its corresponding signal.
If you switch on auto-delete, the TQNetworkProtocol also deletes its TQUrlOperator.
See also TQUrlOperator.
Some operations (such as listChildren()) emit this signal when they start processing the operation. op is the pointer to the operation object which contains all the information about the operation, including the state, etc.
When a protocol emits this signal, TQNetworkProtocol is smart enough to let the TQUrlOperator, which is used by the network protocol, emit its corresponding signal.
Example: network/networkprotocol/nntp.cpp.
This file is part of the TQt toolkit. Copyright © 1995-2007 Trolltech. All Rights Reserved.
Copyright © 2007 Trolltech | Trademarks | TQt 3.3.8
|