本文整理汇总了C++中bytesWritten函数的典型用法代码示例。如果您正苦于以下问题:C++ bytesWritten函数的具体用法?C++ bytesWritten怎么用?C++ bytesWritten使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bytesWritten函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: SIGNAL
/*!
\internal
*/
void QBluetoothHeadsetService::hookupSocket(QBluetoothRfcommSocket *socket)
{
m_data->m_client = socket;
QObject::connect(m_data->m_client, SIGNAL(stateChanged(QBluetoothAbstractSocket::SocketState)),
this, SLOT(stateChanged(QBluetoothAbstractSocket::SocketState)));
QObject::connect(m_data->m_client, SIGNAL(error(QBluetoothAbstractSocket::SocketError)),
this, SLOT(error(QBluetoothAbstractSocket::SocketError)));
QObject::connect(m_data->m_client, SIGNAL(readyRead()),
this, SLOT(readyRead()));
QObject::connect(m_data->m_client, SIGNAL(bytesWritten(qint64)),
this, SLOT(bytesWritten(qint64)));
}
开发者ID:muromec,项目名称:qtopia-ezx,代码行数:15,代码来源:qbluetoothhsservice.cpp
示例17: readyToRead
void readyToRead()
{
bool gotPackets = false;
while (true) {
// Get size header (if not in progress)
if (-1 == inProgressSize) {
// We need a size header of sizeof(qint32)
if (sizeof(qint32) > (uint)dev->bytesAvailable()) {
if (gotPackets)
emit readyRead();
return; // no more data available
}
// Read size header
int read = dev->read((char *)&inProgressSize, sizeof(qint32));
Q_ASSERT(read == sizeof(qint32));
Q_UNUSED(read);
// Check sizing constraints
if (inProgressSize > maxPacketSize) {
QObject::disconnect(dev, SIGNAL(readyRead()),
this, SLOT(readyToRead()));
QObject::disconnect(dev, SIGNAL(aboutToClose()),
this, SLOT(aboutToClose()));
QObject::disconnect(dev, SIGNAL(bytesWritten(qint64)),
this, SLOT(bytesWritten(qint64)));
dev = 0;
emit invalidPacket();
return;
}
inProgressSize -= sizeof(qint32);
} else {
inProgress.append(dev->read(inProgressSize - inProgress.size()));
if (inProgressSize == inProgress.size()) {
// Packet has arrived!
packets.append(inProgress);
inProgressSize = -1;
inProgress.clear();
waitingForPacket = false;
gotPackets = true;
} else {
if (gotPackets)
emit readyRead();
return; // packet in progress is not yet complete
}
}
}
}
开发者ID:mortenelund,项目名称:qt,代码行数:51,代码来源:qpacketprotocol.cpp
示例18: disconnect
/** Set the device used by the JsonStream.
The stream does not take ownership of the device.
*/
void JsonStream::setDevice(QIODevice *device, bool queued)
{
if (mDevice) {
disconnect(mDevice, SIGNAL(readyRead()), this, SLOT(deviceReadyRead()));
disconnect(mDevice, SIGNAL(bytesWritten(qint64)), this, SLOT(deviceBytesWritten(qint64)));
disconnect(mDevice, SIGNAL(aboutToClose()), this, SIGNAL(aboutToClose()));
}
mDevice = device;
if (mDevice) {
connect(mDevice, SIGNAL(readyRead()), this, SLOT(deviceReadyRead()), queued ? Qt::QueuedConnection : Qt::DirectConnection);
connect(mDevice, SIGNAL(bytesWritten(qint64)), this, SLOT(deviceBytesWritten(qint64)));
connect(mDevice, SIGNAL(aboutToClose()), this, SIGNAL(aboutToClose()));
}
}
开发者ID:Distrotech,项目名称:qtjsondb,代码行数:17,代码来源:jsonstream.cpp
示例19: ipAddress
// Send treatment plan
void Server::sendPlan()
{
QHostAddress ipAddress("172.168.0.116");
m_tcpServer->connectToHost(ipAddress, 6666);
QDataStream m_sendOut(&m_outBlock, QIODevice::WriteOnly);
m_sendOut.setVersion(QDataStream::Qt_4_6);
qDebug() << "Sending plan...";
QString sendInfo = writeSendInfo();
// Write data
connect(m_tcpServer, SIGNAL(bytesWritten(qint64)), this, SLOT(writtenBytes(qint64))); // Check if the data has been all well written
m_sendOut << qint64(0)
<< qint64(0)
<< m_plan.coordinate.spotNum
<< m_plan.coordinate.spotPosX
<< m_plan.coordinate.spotPosY
<< m_plan.coordinate.spotPosZ
<< m_plan.parameter.coolingTime
<< m_plan.parameter.dutyCycle
<< m_plan.parameter.sonicationPeriod
<< m_plan.parameter.sonicationTime
<< sendInfo;
qDebug() << "sendInfo:" << sendInfo;
m_totalBytes = m_outBlock.size();
qDebug() << "m_totalBytes:" << m_totalBytes;
m_sendOut.device()->seek(0);
m_sendOut << qint64(2) << m_totalBytes; // Find the head of array and write the haed information
m_tcpServer->write(m_outBlock);
m_sendTimeNum += 1;
m_writtenBytes = 0;
m_outBlock.resize(0);
qDebug() << "Send finished";
// Read send-back data
connect(m_tcpServer, SIGNAL(readyRead()), this, SLOT(readSendBack()));
m_tcpServer->waitForReadyRead(3000);
qDebug() << m_receivedInfo;
// Check the consistency of the send-back data
if(m_receivedInfo == sendInfo)
{
qDebug() << "Send-back checked.";
m_receivedInfo = "";
}
else
{
emit error_sendBackCheck();
qDebug() << "Check failed ! emit error signal...";
}
}
开发者ID:GorgedeLoup,项目名称:TCPModule,代码行数:61,代码来源:server.cpp
示例20: QObject
QHttpConnection::QHttpConnection(QTcpSocket *socket, QObject *parent)
: QObject(parent),
m_socket(socket),
m_parser(0),
m_parserSettings(0),
m_request(0),
m_transmitLen(0),
m_transmitPos(0)
{
m_parser = (http_parser *)malloc(sizeof(http_parser));
http_parser_init(m_parser, HTTP_REQUEST);
m_parserSettings = new http_parser_settings();
m_parserSettings->on_message_begin = MessageBegin;
m_parserSettings->on_url = Url;
m_parserSettings->on_header_field = HeaderField;
m_parserSettings->on_header_value = HeaderValue;
m_parserSettings->on_headers_complete = HeadersComplete;
m_parserSettings->on_body = Body;
m_parserSettings->on_message_complete = MessageComplete;
m_parser->data = this;
connect(socket, SIGNAL(readyRead()), this, SLOT(parseRequest()));
connect(socket, SIGNAL(disconnected()), this, SLOT(socketDisconnected()));
connect(socket, SIGNAL(bytesWritten(qint64)), this, SLOT(updateWriteCount(qint64)));
}
开发者ID:Nava2,项目名称:qhttpserver,代码行数:27,代码来源:qhttpconnection.cpp
注:本文中的bytesWritten函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论