

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 |
| 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:

| quint16 AssistantServer::getPort | ( | ) | const |
| 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().
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 }
quint16 AssistantServer::p [private] |
1.5.1