资源简介
自己写着玩的,实现远程桌面实时监控和鼠标锁定,局域网自动发现,绿色 免安装
代码片段和文件信息
#include “client.h“
#include
#include
#include
#define SERVER_PORT 44444
#define UDP_CLIENT_PORT 44448
#define UDP_SERVER_PORT 44446
Client::Client(QWidget *parent)
: QMainWindow(parent)
{
ui.setupUi(this);
isConnected_ = false;
isRecord_ = false;
socket_ = new QTcpSocket();
socket_->setSocketOption(QAbstractSocket::LowDelayOption 1);
connect(socket_ SIGNAL(readyRead()) this SLOT(readFortune()));
connect(socket_ SIGNAL(error(QAbstractSocket::SocketError)) this SLOT(displayerror(QAbstractSocket::SocketError)));
connect(socket_ SIGNAL(stateChanged(QAbstractSocket::SocketState)) this SLOT(stateChanged(QAbstractSocket::SocketState)));
udpSocket_ = new QUdpSocket(this);
udpSocket_->bind(UDP_CLIENT_PORTQUdpSocket::ShareAddress);
connect(udpSocket_ SIGNAL(readyRead()) this SLOT(readPendingDatagrams()));
connect(&timer_ SIGNAL(timeout()) this SLOT(serverTimeOut()));
timer_.start(5000);
ui.lineEdit_ip->setText(“192.168.“);
showMaximized();
}
Client::~Client()
{
}
void Client::connectServer(QString ip)
{
socket_->abort();
receiveData_.clear();
socket_->connectToHost(QHostAddress(ip) SERVER_PORT);
ui.lineEdit_ip->setText(ip);
}
void Client::readFortune()
{
quint64 bytesAvailable = socket_->bytesAvailable();
if (bytesAvailable <= 0)
return;
QByteArray data = socket_->read(bytesAvailable);
//qDebug() << “from:“ << socket_->peerAddress().toString() << “ size:“ << data.size();
receiveData_.append(data);
processData();
}
void Client::displayerror(QAbstractSocket::SocketError socketError)
{
switch (socketError) {
case QAbstractSocket::RemoteHostClosedError:
break;
case QAbstractSocket::HostNotFoundError:
QMessageBox::information(this tr(“Fortune Client“)
tr(“The host was not found. Please check the “
“host name and port settings.“));
break;
case QAbstractSocket::ConnectionRefusedError:
QMessageBox::information(this tr(“Fortune Client“)
tr(“The connection was refused by the peer. “
“Make sure the fortune server is running “
“and check that the host name and port “
“settings are correct.“));
break;
default:
QMessageBox::information(this tr(“Fortune Client“)
tr(“The following error occurred: %1.“)
.arg(socket_->errorString()));
}
}
void Client::stateChanged(QAbstractSocket::SocketState socketState)
{
switch (socketState) {
case QAbstractSocket::HostLookupState:
case QAbstractSocket::ConnectingState:
break;
case QAbstractSocket::ConnectedState:
isConnected_ = true;
break;
case QAbstractSocket::BoundState:
case QAbstractSocket::ListeningState:
break;
case QAbstractSocket::ClosingState:
case QAbstractSocket::UnconnectedState:
{
isConnected_ = false;
isRecord_ = false;
ui.pushButton_record->setText(QString::fromLocal8Bit(“录像“));
break;
}
default:
Q_ASSERT_X(0 “stateChanged“ “Unknown
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2017-10-10 09:26 Client\
文件 7512 2017-07-20 20:33 Client\client.cpp
文件 1296 2017-05-19 17:47 Client\client.h
文件 66 2017-04-28 09:39 Client\client.qrc
文件 6916 2017-05-19 17:49 Client\client.ui
文件 10506 2017-04-28 09:39 Client\Client.vcxproj
文件 2667 2017-04-28 09:39 Client\Client.vcxproj.filters
文件 1228 2017-07-06 16:30 Client\Client.vcxproj.user
文件 536 2017-05-02 13:43 Client\main.cpp
目录 0 2017-04-28 09:39 Client\Resources\
目录 0 2017-10-10 09:26 Monitor\
文件 1424 2017-04-28 09:39 Monitor.sln
文件 824 2017-05-19 17:10 Monitor\main.cpp
文件 12009 2017-05-01 17:32 Monitor\Monitor.vcxproj
文件 2964 2017-05-01 17:32 Monitor\Monitor.vcxproj.filters
文件 1078 2017-07-06 16:30 Monitor\Monitor.vcxproj.user
文件 1005 2017-05-19 11:30 Monitor\picthread.cpp
文件 328 2017-04-28 09:19 Monitor\picthread.h
目录 0 2017-04-27 17:13 Monitor\Resources\
文件 4719 2017-05-19 17:32 Monitor\server.cpp
文件 662 2017-05-19 17:35 Monitor\server.h
文件 1856 2017-05-19 17:37 Monitor\udpserver.cpp
文件 481 2017-05-19 17:37 Monitor\udpserver.h
目录 0 2017-10-10 09:26 Win32\
目录 0 2017-05-19 11:08 Win32\Release\
文件 69632 2017-05-19 17:32 Win32\Release\Client.exe
文件 35328 2017-05-19 17:36 Win32\Release\Monitor.exe
文件 455328 2017-02-28 15:37 Win32\Release\msvcp120.dll
文件 970912 2017-02-28 15:37 Win32\Release\msvcr120.dll
目录 0 2017-05-02 13:44 Win32\Release\plugins\
目录 0 2017-05-02 13:44 Win32\Release\plugins\audio\
............此处省略121个文件信息
相关资源
- 蚂蚁分类信息系统 v5.9
-
spring-fr
amework-5.0.2.RELEASE-中文注释版 - 智能家居手机APP远程智能控制家居设
- ssh项目实战源码
- spring+springmvc+hibernate框架配置源码
- STL源码+STL源码剖析简体中文完整版带
- 简单的H5游戏源码
- lxy杰伦情歌项目源码
- flashas3拼图游戏源码
- 40个微信H5游戏源码
- unity3d俄罗斯方块源码
- Hog特征提取 源码(免费)
- 可以真实运行的小区物业管理系统源
- freetype2+SDL+SDL_ttf源码包及字符串转b
- qq农场源码
- 基于S2SH网上商城项目源码
- NeHe_OpenGL_VC版本1-48课全部教程以及源
- 基于opencv的远程视频监控智能小车
- 灰鸽子1.2完整源码+完整控件
- 完整的ssh项目源码
- MTCNN+人脸动态贴纸源码+DEMO
- ZigBee上位机程序带源码
- 基于STM32F407的大棚种植远程监控系统
- 精通特征工程.pdf源码.zip
- 图灵书籍(react快速上手开发.pdf+深入
- 图灵书籍(Node.js开发指南.pdf+Node We
- nodejs实战pdf 源码.zip
- linux远程连接工具SecureCRT
- 2019最新某小说网站源码小说站必备杰
- ESP8266控制APP+源码合集
评论
共有 条评论