From 252a2ec8b0f0f9cf20c947737087b24a8185b588 Mon Sep 17 00:00:00 2001 From: Michele Calgaro Date: Wed, 10 Jul 2024 18:56:16 +0900 Subject: Rename IO and network class nt* related files to equivalent tq* Signed-off-by: Michele Calgaro --- doc/html/clientserver-example.html | 44 +++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 22 deletions(-) (limited to 'doc/html/clientserver-example.html') diff --git a/doc/html/clientserver-example.html b/doc/html/clientserver-example.html index d44930b68..d4bcd90bd 100644 --- a/doc/html/clientserver-example.html +++ b/doc/html/clientserver-example.html @@ -35,8 +35,8 @@ body { background: #ffffff; color: black; }

This example shows how two programs can communicate using sockets.

Two simple example programs are provided, a client program and a -server program. Both use the TQSocket class, and the server also uses -TQServerSocket class. +server program. Both use the TQSocket class, and the server also uses +TQServerSocket class.

The server listens on port number 4242 and accepts incoming connections. It sends back every line it receives from the client, prepended with the line number. @@ -55,8 +55,8 @@ specified. You can send single lines to the server. ** *****************************************************************************/ -#include <ntqsocket.h> -#include <ntqserversocket.h> +#include <tqsocket.h> +#include <tqserversocket.h> #include <ntqapplication.h> #include <ntqvbox.h> #include <tqtextview.h> @@ -72,12 +72,12 @@ specified. You can send single lines to the server. For every client that connects to the server, the server creates a new instance of this class. */ -class ClientSocket : public TQSocket +class ClientSocket : public TQSocket { TQ_OBJECT public: ClientSocket( int sock, TQObject *parent=0, const char *name=0 ) : - TQSocket( parent, name ) + TQSocket( parent, name ) { line = 0; connect( this, TQ_SIGNAL(readyRead()), @@ -119,12 +119,12 @@ private: client that connects, it creates a new ClientSocket -- that instance is now responsible for the communication with that client. */ -class SimpleServer : public TQServerSocket +class SimpleServer : public TQServerSocket { TQ_OBJECT public: SimpleServer( TQObject* parent=0 ) : - TQServerSocket( 4242, 1, parent ) + TQServerSocket( 4242, 1, parent ) { if ( !ok() ) { tqWarning("Failed to bind to port 4242"); @@ -184,7 +184,7 @@ private slots: infoText->append( tr("New connection\n") ); connect( s, TQ_SIGNAL(logText(const TQString&)), infoText, TQ_SLOT(append(const TQString&)) ); - connect( s, TQ_SIGNAL(connectionClosed()), + connect( s, TQ_SIGNAL(connectionClosed()), TQ_SLOT(connectionClosed()) ); } @@ -222,7 +222,7 @@ int main( int argc, char** argv ) ** *****************************************************************************/ -#include <ntqsocket.h> +#include <tqsocket.h> #include <ntqapplication.h> #include <ntqvbox.h> #include <ntqhbox.h> @@ -252,19 +252,19 @@ public: connect( quit, TQ_SIGNAL(clicked()), tqApp, TQ_SLOT(quit()) ); // create the socket and connect various of its signals - socket = new TQSocket( this ); - connect( socket, TQ_SIGNAL(connected()), + socket = new TQSocket( this ); + connect( socket, TQ_SIGNAL(connected()), TQ_SLOT(socketConnected()) ); - connect( socket, TQ_SIGNAL(connectionClosed()), + connect( socket, TQ_SIGNAL(connectionClosed()), TQ_SLOT(socketConnectionClosed()) ); - connect( socket, TQ_SIGNAL(readyRead()), + connect( socket, TQ_SIGNAL(readyRead()), TQ_SLOT(socketReadyRead()) ); - connect( socket, TQ_SIGNAL(error(int)), + connect( socket, TQ_SIGNAL(error(int)), TQ_SLOT(socketError(int)) ); // connect to the server infoText->append( tr("Trying to connect to the server\n") ); - socket->connectToHost( host, port ); + socket->connectToHost( host, port ); } ~Client() @@ -274,10 +274,10 @@ public: private slots: void closeConnection() { - socket->close(); - if ( socket->state() == TQSocket::Closing ) { + socket->close(); + if ( socket->state() == TQSocket::Closing ) { // We have a delayed close. - connect( socket, TQ_SIGNAL(delayedCloseFinished()), + connect( socket, TQ_SIGNAL(delayedCloseFinished()), TQ_SLOT(socketClosed()) ); } else { // The socket is closed. @@ -296,8 +296,8 @@ private slots: void socketReadyRead() { // read from the server - while ( socket->canReadLine() ) { - infoText->append( socket->readLine() ); + while ( socket->canReadLine() ) { + infoText->append( socket->readLine() ); } } @@ -322,7 +322,7 @@ private slots: } private: - TQSocket *socket; + TQSocket *socket; TQTextView *infoText; TQLineEdit *inputText; }; -- cgit v1.2.1