AssistantServer Class Reference

Inheritance diagram for AssistantServer:

Inheritance graph
[legend]
Collaboration diagram for AssistantServer:

Collaboration graph
[legend]
List of all members.

Detailed Description

Definition at line 91 of file main.cpp.

Public Slots

virtual void incomingConnection (int socket)

Signals

void showLinkRequest (const QString &)
void newConnect ()

Public Member Functions

 AssistantServer (QObject *parent=0)
quint16 getPort () const

Private Attributes

quint16 p


Constructor & Destructor Documentation

AssistantServer::AssistantServer ( QObject parent = 0  ) 

Definition at line 136 of file main.cpp.

References QMessageBox::critical(), QTcpServer::isListening(), QTcpServer::listen(), QHostAddress::LocalHost, p, and QTcpServer::serverPort().

00137     : QTcpServer( parent )
00138 {
00139     listen(QHostAddress::LocalHost, 0);
00140     if ( !isListening() ) {
00141         QMessageBox::critical( 0, tr( "Qt Assistant" ),
00142                 tr( "Failed to bind to port %1" ).arg( serverPort() ) );
00143         exit( 1 );
00144     }
00145     p = serverPort();
00146 }

Here is the call graph for this function:


Member Function Documentation

quint16 AssistantServer::getPort (  )  const

Definition at line 148 of file main.cpp.

References p.

00149 {
00150     return p;
00151 }

void AssistantServer::showLinkRequest ( const QString  )  [signal]

Referenced by incomingConnection().

void AssistantServer::newConnect (  )  [signal]

Referenced by incomingConnection().

void AssistantServer::incomingConnection ( int  socket  )  [virtual, slot]

This virtual function is called by QTcpServer when a new connection is available. The socketDescriptor argument is the native socket descriptor for the accepted connection.

The base implementation creates a QTcpSocket, sets the socket descriptor and then stores the QTcpSocket in an internal list of pending connections. Finally newConnection() is emitted.

Reimplement this function to alter the server's behavior when a connection is available.

If this server is using QNetworkProxy then the socketDescriptor may not be usable with native socket functions, and should only be used with QTcpSocket::setSocketDescriptor().

See also:
newConnection(), nextPendingConnection()

Reimplemented from QTcpServer.

Definition at line 153 of file main.cpp.

References QObject::connect(), emit, newConnect(), showLinkRequest(), and SIGNAL.

00154 {
00155     AssistantSocket *as = new AssistantSocket( socket, this );
00156     connect( as, SIGNAL(showLinkRequest(QString)),
00157              this, SIGNAL(showLinkRequest(QString)) );
00158     emit newConnect();
00159 }


Member Data Documentation

quint16 AssistantServer::p [private]

Definition at line 106 of file main.cpp.

Referenced by AssistantServer(), and getPort().


The documentation for this class was generated from the following file:
Generated on Thu Mar 15 14:44:46 2007 for Qt 4.2 User's Guide by  doxygen 1.5.1