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


C++ bytesWritten函数代码示例

本文整理汇总了C++中bytesWritten函数的典型用法代码示例。如果您正苦于以下问题:C++ bytesWritten函数的具体用法?C++ bytesWritten怎么用?C++ bytesWritten使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: QTcpSocket

bool IpsEngineClient::doConnect()
{
    if(!socket)
    {
        socket = new QTcpSocket(this);
        connect(socket, SIGNAL(connected()),this, SLOT(connected()));
        connect(socket, SIGNAL(disconnected()),this, SLOT(disconnected()));
        connect(socket, SIGNAL(bytesWritten(qint64)),this, SLOT(bytesWritten(qint64)));
        connect(socket, SIGNAL(readyRead()),this, SLOT(readyRead()));
        connect(socket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(displayError(QAbstractSocket::SocketError)));
    }
    opened=false;
    busy=true;

    qDebug() << "connecting...";

    // this is not blocking call
    socket->connectToHost(QHostAddress::LocalHost, 58486);

    // we need to wait...
    if(!socket->waitForConnected(10000))
    {
        qDebug() << "Error: " << socket->errorString();
        busy=false;
        return false;
    }
    busy=false;
    return true;
}
开发者ID:tcvicio,项目名称:PGE-Project,代码行数:29,代码来源:engine_client.cpp

示例2: disconnect

void QmlIODevice::setDevice(QIODevice *io)
{
    if(m_device != io) {

        //! 如果 m_device 被删除了怎么办?
        if(m_device != Q_NULLPTR) {
           disconnect(m_device, 0, this, 0);
        }

        m_device = io;

        if(m_device != Q_NULLPTR) {
            connect( m_device,SIGNAL(aboutToClose()),
                     this, SIGNAL(aboutToClose()) );

            connect( m_device, SIGNAL(bytesWritten(qint64)),
                     this, SIGNAL(bytesWritten(qint64)) );

            connect( m_device, SIGNAL(readChannelFinished()),
                     this, SIGNAL(readChannelFinished()) );

            connect( m_device, SIGNAL(readyRead()),
                     this, SIGNAL(readyRead()) );
        }

        emit deviceChanged();
        emit hasDeviceChanged(this->hasDevice());
    }
}
开发者ID:qyvlik,项目名称:QmlNetwork,代码行数:29,代码来源:qmliodevice.cpp

示例3: QTcpSocket

// Constructs an unconnected PeerWire client and starts the connect timer.
PeerWireClient::PeerWireClient(const QByteArray &peerId, QObject *parent)
    : QTcpSocket(parent), pendingBlockSizes(0),
      pwState(ChokingPeer | ChokedByPeer), receivedHandShake(false), gotPeerId(false),
      sentHandShake(false), nextPacketLength(-1), pendingRequestTimer(0), invalidateTimeout(false),
      keepAliveTimer(0), torrentPeer(0)
{
    memset(uploadSpeedData, 0, sizeof(uploadSpeedData));
    memset(downloadSpeedData, 0, sizeof(downloadSpeedData));

    transferSpeedTimer = startTimer(RateControlTimerDelay);
    timeoutTimer = startTimer(ConnectTimeout);
    peerIdString = peerId;

    connect(this, SIGNAL(readyRead()), this, SIGNAL(readyToTransfer()));
    connect(this, SIGNAL(connected()), this, SIGNAL(readyToTransfer()));

    connect(&socket, SIGNAL(connected()),
            this, SIGNAL(connected()));
    connect(&socket, SIGNAL(readyRead()),
            this, SIGNAL(readyRead()));
    connect(&socket, SIGNAL(disconnected()),
            this, SIGNAL(disconnected()));
    connect(&socket, SIGNAL(error(QAbstractSocket::SocketError)),
            this, SIGNAL(error(QAbstractSocket::SocketError)));
    connect(&socket, SIGNAL(bytesWritten(qint64)),
            this, SIGNAL(bytesWritten(qint64)));
    connect(&socket, SIGNAL(stateChanged(QAbstractSocket::SocketState)),
            this, SLOT(socketStateChanged(QAbstractSocket::SocketState)));

}
开发者ID:SfietKonstantin,项目名称:radeon-qt5-qtbase-kms,代码行数:31,代码来源:peerwireclient.cpp

示例4: QMainWindow

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow),
    serverView(0),
    manager(0)
{
    ui->setupUi(this);
    serverView = new ChannelDisplay(ui->tabList);
    ui->tabList->addTab(serverView, "Server");
    ui->tabList->setCurrentIndex(0);
    manager = new IrcManager(ui, serverView, &sock);

    enableConnect();

    connect(&sock, SIGNAL(connected()), this, SLOT(connected()));
    connect(&sock,SIGNAL(disconnected()), this, SLOT(disconnected()));
    connect(&sock,SIGNAL(bytesWritten(qint64)), this, SLOT(bytesWritten(qint64)));
    connect(&sock,SIGNAL(readyRead()),this,SLOT(readyRead()));
    connect(ui->sendButton,SIGNAL(clicked(bool)),this,SLOT(issueQuery()));
    connect(ui->connectButton,SIGNAL(clicked(bool)),this,SLOT(connectToServer()));
    connect(&sock,SIGNAL(error(QAbstractSocket::SocketError)),this,SLOT(error(QAbstractSocket::SocketError)));
    connect(ui->disconnectButton,SIGNAL(clicked(bool)),this,SLOT(disconnect()));
    connect(ui->queryEdit, SIGNAL(returnPressed()), this, SLOT(issueQuery()));
    connect(ui->joinButton, SIGNAL(clicked(bool)), this, SLOT(join()));
}
开发者ID:chvink,项目名称:IRCrap,代码行数:25,代码来源:mainwindow.cpp

示例5: QTcpSocket

void QThreadTCP::connect()
{

    isconnected = false;
    socket = new QTcpSocket();

    QThreadTCP::QObject::connect(socket, SIGNAL(connected()),this, SLOT(connected()));
    QThreadTCP::QObject::connect(socket, SIGNAL(disconnected()),this, SLOT(disconnected()));
    QThreadTCP::QObject::connect(socket, SIGNAL(bytesWritten(qint64)),this, SLOT(bytesWritten(qint64)));
    QThreadTCP::QObject::connect(socket, SIGNAL(readyRead()),this, SLOT(readyRead()));


    processclient = new QProcess();
    processclient->closeReadChannel(QProcess::StandardOutput);
    processclient->closeReadChannel(QProcess::StandardError);

    connection_loop = true;


    //boost::thread _thread_logic(&QThreadTCP::boost_run,this);



    timer = new QTimer(this);
    QThreadTCP::QObject:: connect(timer, SIGNAL(timeout()), this, SLOT(update()));


    //timer->start(10000);
}
开发者ID:cxdcxd,项目名称:pgitic_gstramer,代码行数:29,代码来源:qthreadtcp.cpp

示例6: QTcpSocket

//Command argument contain wether command is upload or download
//if download also provide filename and if upload porvide path of file
void ServerCliant::test(QString Command,QString ClassFilepath)
{
    DownloadStrted=0;
    downloadFilePath ="D:/dk work/Motarola/project/teacher/";



    int pos = Command.indexOf(" ");
    CCommand = Command.mid(0,pos).trimmed();
    fileNameOrPath = Command.mid(pos + 1).trimmed();

    //full path of the class or if scecific student index
    ClassName =ClassFilepath;



    socket = new QTcpSocket(this);

    connect(socket,SIGNAL(connected()),this,SLOT(connected()));
    connect(socket,SIGNAL(disconnected()),this,SLOT(disconnected()));
    connect(socket,SIGNAL(bytesWritten(qint64 )),this,SLOT(bytesWritten(qint64 )));
    connect(socket,SIGNAL(readyRead()),this,SLOT(readyRead()));


    qDebug()<<"conneting...";

    socket->connectToHost("127.0.0.1",1234);

    if(!socket->waitForConnected(5000))
    {
        qDebug()<<"Error:"<<socket->errorString();
    }

}
开发者ID:bindumotarola,项目名称:FileTransferClient,代码行数:36,代码来源:servercliant.cpp

示例7: SIGNAL

void	TcpClient::initFromSocket(void *socket) {
	mQTcpSocket = reinterpret_cast<QTcpSocket *>(socket);

	QObject::connect(mQTcpSocket, SIGNAL(readyRead()), this, SLOT(markAsReadable()));
	QObject::connect(mQTcpSocket, SIGNAL(disconnected()), this, SLOT(close()));
	QObject::connect(mQTcpSocket, SIGNAL(bytesWritten(qint64)), this, SLOT(bytesWritten(qint64)));
}
开发者ID:gvsurenderreddy,项目名称:Babel-VOIP,代码行数:7,代码来源:TcpClient.cpp

示例8: connect

void CNetworkConnection::initializeSocket()
{
	m_pSocket->disconnect();

	connect(m_pSocket, SIGNAL(connected()),
			this, SIGNAL(connected()));
	connect(m_pSocket, SIGNAL(connected()),
			this, SIGNAL(readyToTransfer()));
	connect(m_pSocket, SIGNAL(readyRead()),
			this, SIGNAL(readyToTransfer()));
	connect(m_pSocket, SIGNAL(disconnected()),
			this, SIGNAL(disconnected()));
	connect(m_pSocket, SIGNAL(error(QAbstractSocket::SocketError)),
			this, SIGNAL(error(QAbstractSocket::SocketError)));
	connect(m_pSocket, SIGNAL(bytesWritten(qint64)),
			this, SIGNAL(bytesWritten(qint64)));
	connect(m_pSocket, SIGNAL(stateChanged(QAbstractSocket::SocketState)),
			this, SIGNAL(stateChanged(QAbstractSocket::SocketState)));
	connect(m_pSocket, SIGNAL(aboutToClose()),
			this, SLOT(OnAboutToClose()));

	connect(this, SIGNAL(connected()), this, SLOT(OnConnect()), Qt::QueuedConnection);
	connect(this, SIGNAL(disconnected()), this, SLOT(OnDisconnect()), Qt::QueuedConnection);
	connect(this, SIGNAL(readyRead()), this, SLOT(OnRead()), Qt::QueuedConnection);
	connect(this, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(OnError(QAbstractSocket::SocketError)), Qt::QueuedConnection);
	connect(this, SIGNAL(stateChanged(QAbstractSocket::SocketState)), this, SLOT(OnStateChange(QAbstractSocket::SocketState)), Qt::QueuedConnection);
}
开发者ID:BackupTheBerlios,项目名称:quazaa-svn,代码行数:27,代码来源:networkconnection.cpp

示例9: qDebug

void
Connection::doSetup()
{
    qDebug() << Q_FUNC_INFO << thread();
    /*
        New connections can be created from other thread contexts, such as
        when AudioEngine calls getIODevice.. - we need to ensure that connections
        and their associated sockets are running in the same thread as the servent.

        HINT: export QT_FATAL_WARNINGS=1 helps to catch these kind of errors.
     */
    if( QThread::currentThread() != m_servent->thread() )
    {
        // Connections should always be in the same thread as the servent.
        qDebug() << "Fixing thead affinity...";
        moveToThread( m_servent->thread() );
        qDebug() << Q_FUNC_INFO  << thread();
    }

    //stats timer calculates BW used by this connection
    m_statstimer = new QTimer;
    m_statstimer->moveToThread( this->thread() );
    m_statstimer->setInterval( 1000 );
    connect( m_statstimer, SIGNAL( timeout() ), SLOT( calcStats() ) );
    m_statstimer->start();
    m_statstimer_mark.start();

    m_sock->moveToThread( thread() );

    connect( m_sock.data(), SIGNAL( bytesWritten( qint64 ) ),
                              SLOT( bytesWritten( qint64 ) ), Qt::QueuedConnection );

    connect( m_sock.data(), SIGNAL( disconnected() ),
                              SLOT( socketDisconnected() ), Qt::QueuedConnection );

    connect( m_sock.data(), SIGNAL( error( QAbstractSocket::SocketError ) ),
                              SLOT( socketDisconnectedError( QAbstractSocket::SocketError ) ), Qt::QueuedConnection );

    connect( m_sock.data(), SIGNAL( readyRead() ),
                              SLOT( readyRead() ), Qt::QueuedConnection );

    // if connection not authed/setup fast enough, kill it:
    QTimer::singleShot( AUTH_TIMEOUT, this, SLOT( authCheckTimeout() ) );

    if( outbound() )
    {
        Q_ASSERT( !m_firstmsg.isNull() );
        sendMsg( m_firstmsg );
    }
    else
    {
        sendMsg( Msg::factory( PROTOVER, Msg::SETUP ) );
    }

    // call readyRead incase we missed the signal in between the servent disconnecting and us
    // connecting to the signal - won't do anything if there are no bytesAvailable anyway.
    readyRead();
}
开发者ID:MechanisM,项目名称:tomahawk,代码行数:58,代码来源:connection.cpp

示例10: QTcpSocket

void MsgStream::init(void) {
	socket = new QTcpSocket(this);
	connect(socket, SIGNAL(connected()), this, SLOT(connected()));
	connect(socket, SIGNAL(disconnected()), this, SLOT(disconnected()));
	connect(socket, SIGNAL(readyRead()), this, SLOT(readyRead()));
	connect(socket, SIGNAL(bytesWritten(qint64)), this, SLOT(bytesWritten(qint64)));

	QHostAddress hostAddress(peerAddress);
	socket->connectToHost(hostAddress, port);
}
开发者ID:j2doll,项目名称:lmc-clone,代码行数:10,代码来源:netstreamer.cpp

示例11: close

void	TcpClient::connect(const std::string &addr, int port) {
	close(false);
	mQTcpSocket->connectToHost(QString(addr.c_str()), port);

	if (mQTcpSocket->waitForConnected(-1) == false)
		throw SocketException("fail QTcpSocket::connectToHost & QTcpSocket::waitForConnected");

	QObject::connect(mQTcpSocket, SIGNAL(readyRead()), this, SLOT(markAsReadable()));
	QObject::connect(mQTcpSocket, SIGNAL(disconnected()), this, SLOT(close()));
	QObject::connect(mQTcpSocket, SIGNAL(bytesWritten(qint64)), this, SLOT(bytesWritten(qint64)));
}
开发者ID:gvsurenderreddy,项目名称:Babel-VOIP,代码行数:11,代码来源:TcpClient.cpp

示例12: QProcess

childProcess_t::childProcess_t (process_t * parent)
	: QProcess(parent)
{
	QObject::connect(this, SIGNAL(error (QProcess::ProcessError)), this, SLOT(error (QProcess::ProcessError)));
	QObject::connect(this, SIGNAL(finished (int, QProcess::ExitStatus)), this, SLOT(finished (int, QProcess::ExitStatus)));
	QObject::connect(this, SIGNAL(readyReadStandardError(void)), this, SLOT(readyReadStandardError(void)));
	QObject::connect(this, SIGNAL(readyReadStandardOutput(void)), this, SLOT(readyReadStandardOutput(void)));
	QObject::connect(this, SIGNAL(started (void)), this, SLOT(started (void)));
	QObject::connect(this, SIGNAL(stateChanged(QProcess::ProcessState)), this, SLOT(stateChanged(QProcess::ProcessState)));
	QObject::connect(this, SIGNAL(bytesWritten(qint64)), this, SLOT(bytesWritten(qint64)));
}
开发者ID:boundarydevices,项目名称:qtbrowser,代码行数:11,代码来源:process.cpp

示例13: QTcpSocket

void TCPClient::declareAndConnectSockets()
{
    //Declare TCP and UDP sockets:
    if (tcpSocket) delete tcpSocket;
    if (udpSocket) delete udpSocket;
    tcpSocket = new QTcpSocket();
    udpSocket = new QUdpSocket();

    connect (tcpSocket, SIGNAL(disconnected()), this, SLOT(disconnected()), Qt::QueuedConnection);
    connect (tcpSocket, SIGNAL(readyRead()), this, SLOT(readyRead()), Qt::QueuedConnection);
    connect (tcpSocket, SIGNAL(bytesWritten(qint64)), this, SLOT(bytesWritten(qint64)), Qt::QueuedConnection);
}
开发者ID:alvesrod,项目名称:tableproject,代码行数:12,代码来源:tcpclient.cpp

示例14: disconnect

IpsEngineClient::~IpsEngineClient()
{
    if(socket)
    {
        disconnect(socket, SIGNAL(connected()),this, SLOT(connected()));
        disconnect(socket, SIGNAL(disconnected()),this, SLOT(disconnected()));
        disconnect(socket, SIGNAL(bytesWritten(qint64)),this, SLOT(bytesWritten(qint64)));
        disconnect(socket, SIGNAL(readyRead()),this, SLOT(readyRead()));
        disconnect(socket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(displayError(QAbstractSocket::SocketError)));
        delete socket;
    }
}
开发者ID:tcvicio,项目名称:PGE-Project,代码行数:12,代码来源:engine_client.cpp

示例15: QWidget

// the playScreen is the screen for the single player game.
// it takes in the file path to the image the user wants to use
// and cuts it up into tiles and displays them on the screen with various
// menu buttons and statistics. It also handles tile clicks and tile swapping.
PlayScreen::PlayScreen(QString imgPath, MainWindow *mainWindow, QWidget *parent) : QWidget(parent)
{
    this->imgPath = imgPath;
    this->mainWindow = mainWindow;

    socket = new QTcpSocket(this);

    connect(socket, SIGNAL(connected()), this, SLOT(connected()));
    connect(socket, SIGNAL(disconnected()), this, SLOT(disconnected()));
    connect(socket, SIGNAL(readyRead()), this, SLOT(readyRead()));
    connect(socket, SIGNAL(bytesWritten(qint64)), this, SLOT(bytesWritten(qint64)));
}
开发者ID:CS340,项目名称:PuzzleApp,代码行数:16,代码来源:playscreen.cpp


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