TTKMusicPlayer  3.7.0.0
TTKMusicPlayer imitates Kugou UI, the music player uses of qmmp core library based on Qt for windows and linux
Signals | Public Member Functions | Private Slots | List of all members
QHttpServer Class Reference

The class of the http server. More...

#include <qhttpserver.h>

+ Inheritance diagram for QHttpServer:

Signals

void newRequest (QHttpRequest *request, QHttpResponse *response)
 Emitted when a client makes a new request to the server. More...
 

Public Member Functions

 QHttpServer (QObject *parent=nullptr)
 Construct a new HTTP Server. More...
 
bool listen (const QHostAddress &address=QHostAddress::Any, quint16 port=80)
 Start the server by bounding to the given address and port. More...
 
bool listen (quint16 port)
 Starts the server on port listening on all interfaces. More...
 
void close ()
 Stop the server and listening for new connections. More...
 

Private Slots

void newConnection ()
 

Detailed Description

The class of the http server.

Author
Greedysky greed.nosp@m.ysky.nosp@m.@163..nosp@m.com

Definition at line 37 of file qhttpserver.h.

Constructor & Destructor Documentation

QHttpServer::QHttpServer ( QObject *  parent = nullptr)
explicit

Construct a new HTTP Server.

Parameters
parentParent QObject for the server.

Definition at line 75 of file qhttpserver.cpp.

References STATUS_CODE, and TTK_INIT_PRIVATE.

Member Function Documentation

void QHttpServer::close ( )

Stop the server and listening for new connections.

Definition at line 151 of file qhttpserver.cpp.

References TTK_D.

Referenced by QDlnaFileServerPrivate::~QDlnaFileServerPrivate().

bool QHttpServer::listen ( const QHostAddress &  address = QHostAddress::Any,
quint16  port = 80 
)

Start the server by bounding to the given address and port.

Note
This function returns immediately, it does not block.
Parameters
addressAddress on which to listen to. Default is to listen on all interfaces which means the server can be accessed from anywhere.
portPort number on which the server should run.
Returns
True if the server was started successfully, false otherwise.
See also
listen(quint16)

Definition at line 140 of file qhttpserver.cpp.

References TTK_D.

Referenced by listen().

bool QHttpServer::listen ( quint16  port)

Starts the server on port listening on all interfaces.

Parameters
portPort number on which the server should run.
Returns
True if the server was started successfully, false otherwise.
See also
listen(const QHostAddress&, quint16)

Definition at line 146 of file qhttpserver.cpp.

References listen().

void QHttpServer::newConnection ( )
privateslot

Definition at line 134 of file qhttpserver.cpp.

References TTK_D.

void QHttpServer::newRequest ( QHttpRequest request,
QHttpResponse response 
)
signal

Emitted when a client makes a new request to the server.

The slot should use the given request and response objects to communicate with the client.

Parameters
requestNew incoming request.
responseResponse object to the request.

The documentation for this class was generated from the following files: