Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

24 lines (18 sloc) 0.591 kB
#include "Server.h"
#include "Connection.h"
#include "WebPageManager.h"
#include <QTcpServer>
Server::Server(QObject *parent) : QObject(parent) {
m_tcp_server = new QTcpServer(this);
}
bool Server::start() {
connect(m_tcp_server, SIGNAL(newConnection()), this, SLOT(handleConnection()));
return m_tcp_server->listen(QHostAddress::LocalHost, 0);
}
quint16 Server::server_port() const {
return m_tcp_server->serverPort();
}
void Server::handleConnection() {
QTcpSocket *socket = m_tcp_server->nextPendingConnection();
new Connection(socket, new WebPageManager(this), this);
}
Jump to Line
Something went wrong with that request. Please try again.