当前位置: 首页>>代码示例>>C++>>正文


C++ QTcpSocket::parent方法代码示例

本文整理汇总了C++中QTcpSocket::parent方法的典型用法代码示例。如果您正苦于以下问题:C++ QTcpSocket::parent方法的具体用法?C++ QTcpSocket::parent怎么用?C++ QTcpSocket::parent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QTcpSocket的用法示例。


在下文中一共展示了QTcpSocket::parent方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: closeProxySocket

/**
 * 接続を閉じる
 */
void YASWebProxy::closeProxySocket()
{
    QTcpSocket* proxySocket = qobject_cast<QTcpSocket*>(sender());
    if (proxySocket) {
        QTcpSocket* socket = qobject_cast<QTcpSocket*>(proxySocket->parent());
        if (socket)
            socket->disconnectFromHost();
        proxySocket->deleteLater();
    }
}
开发者ID:KoharaKazuya,项目名称:YetAnotherSecretary,代码行数:13,代码来源:yaswebproxy.cpp

示例2: closeConnection

    /*------------------------------------------------------------------------------*

     *------------------------------------------------------------------------------*/
    void WebProxy::closeConnection() {
        QTcpSocket *proxySocket = qobject_cast<QTcpSocket*>(sender());
        if (proxySocket) {
            QTcpSocket *socket = qobject_cast<QTcpSocket*>(proxySocket->parent());
            if (socket)
                socket->disconnectFromHost();
            if (proxySocket->error() != QTcpSocket::RemoteHostClosedError)
                qWarning() << "Error for:" << proxySocket->property("url").toUrl() << proxySocket->errorString();
            proxySocket->deleteLater();;
        }
    } //WebProxy::closeConnection
开发者ID:peder2key,项目名称:gpsbook,代码行数:14,代码来源:webproxy.cpp

示例3: onProxySocketConnectedHttps

void HttpProxy::onProxySocketConnectedHttps()
{
    QTcpSocket *proxySocket = qobject_cast<QTcpSocket *>(sender());
    QTcpSocket *socket = qobject_cast<QTcpSocket *>(proxySocket->parent());
    disconnect(socket, &QTcpSocket::readyRead, this, &HttpProxy::onSocketReadyRead);

    /* once it's connected, we use a light-weight SocketStream class to do the job */
    SocketStream *stream = new SocketStream(socket, proxySocket, this);
    connect(socket, &QTcpSocket::disconnected, stream, &SocketStream::deleteLater);
    connect(stream, &SocketStream::info, this, &HttpProxy::info);
    static const QByteArray httpsHeader = "HTTP/1.0 200 Connection established\r\n\r\n";
    socket->write(httpsHeader);
}
开发者ID:nazhenhuiyi,项目名称:libQtShadowsocks,代码行数:13,代码来源:httpproxy.cpp

示例4: forwardResponse

/**
 * レスポンスを転送する
 */
void YASWebProxy::forwardResponse()
{
    QTcpSocket* proxySocket = qobject_cast<QTcpSocket*>(sender());
    QTcpSocket* socket = qobject_cast<QTcpSocket*>(proxySocket->parent());
    QByteArray res = proxySocket->readAll();

    HttpParser* parser = proxySocket->findChild<HttpParser*>("responseParser");
    if (parser != 0) {
        parser->input(res);
        socket->write(parser->dequeueData());
    } else {
        socket->write(res);
    }
}
开发者ID:KoharaKazuya,项目名称:YetAnotherSecretary,代码行数:17,代码来源:yaswebproxy.cpp

示例5: onProxySocketReadyRead

void HttpProxy::onProxySocketReadyRead()
{
    QTcpSocket *proxySocket = qobject_cast<QTcpSocket *>(sender());
    QTcpSocket *socket = qobject_cast<QTcpSocket *>(proxySocket->parent());
    socket->write(proxySocket->readAll());
}
开发者ID:nazhenhuiyi,项目名称:libQtShadowsocks,代码行数:6,代码来源:httpproxy.cpp

示例6: transferData

    /*------------------------------------------------------------------------------*

     *------------------------------------------------------------------------------*/
    void WebProxy::transferData() {
        QTcpSocket *proxySocket = qobject_cast<QTcpSocket*>(sender());
        QTcpSocket *socket = qobject_cast<QTcpSocket*>(proxySocket->parent());
        socket->write(proxySocket->readAll());
    } //WebProxy::transferData
开发者ID:peder2key,项目名称:gpsbook,代码行数:8,代码来源:webproxy.cpp


注:本文中的QTcpSocket::parent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。