TCP简介
下面我们通过一个项目来感受
一、实现功能
服务器功能:
1、输入端口号
2、打开/关闭服务器
3、向客户端发送数据
客户端功能:
1、输入服务器IP地址、端口号
2、连接/断开服务器
3、向服务器发送数据
二、最终实现的效果
1、服务器最终效果

2、客户端最终效果

3、互发数据实现(写的比较仓促、后序继续完善)

墨衍会员
·
AI 创作全网分发
墨衍智能分发
本文由作者通过墨衍一键同步至各平台
1分发平台
300+累计阅读
391平均单平台
已同步平台
CSDN
微信公众号
微博
知乎
掘金
百家号
博客园
抖音
小红书
你的文章也可以这样分发
墨衍会员 ¥399起/年,写一次发全网
我也要 →
码龄8年
1、输入端口号
2、打开/关闭服务器
3、向客户端发送数据
1、输入服务器IP地址、端口号
2、连接/断开服务器
3、向服务器发送数据
1、服务器最终效果

2、客户端最终效果

3、互发数据实现(写的比较仓促、后序继续完善)

Liunx QT开发篇
当前文章被以下社区和专栏收录:
基于QT的【第一个项目】设计+所有组件配合使用+网络编程局域网通信+文件IO操作+登录界面和头像+多界面跳转+JSON数据解析+表情包制作
基于QT的第一个项目+所有组件配合使用+网络编程局域网通信+文件IO操作+登录界面和头像+多界面跳转+JSON数据解析+表情包制作 第一阶段 网络编程局域网TCP/IP聊天QT实现 main.c mainwindow.h mainwindow.c MainWindow.ui 第二阶段 图片网址加载和天气数据JSON解析源码 live.h live.c live.ui 第三阶段 图标实现,表情包制作 cpdd.h cpdd.c cpdd.ui
QT-有哪些实用的开源项目?
OpenShot Video Editor(视频编辑软件):基于Qt框架的免费、开源的视频编辑软件,支持多种视频编辑和剪辑操作。QGIS(地理信息系统):使用Qt框架开发的免费、开源的地理信息系统工具,支持多种地图数据的导入、编辑和分析。Scribus(桌面排版软件):使用Qt框架实现的跨平台桌面排版软件,支持多种桌面出版物的设计和排版。MuseScore(乐谱编辑软件):基于Qt框架的免费、开源的乐谱编辑软件,支持多种乐器的分谱和排版。
QT基础教程(QT网络编程)
Qt 提供了丰富的网络编程支持,通过 Qt Network 模块可以方便地实现网络通信。这个模块提供了用于处理网络协议、创建网络应用程序和进行网络操作的类。Qt 的网络编程框架主要包括以下几个关键类:QNetworkAccessManager:用于处理网络请求和响应。QNetworkReply:表示一个网络请求的响应。QNetworkRequest:表示一个网络请求。QTcpSocket 和 QTcpServer:用于 TCP 连接和服务器。QUdpSocket:用于 UDP 连接。
linux的qt的tcp通信,QT实现简单的tcp通信聊天工具
QT实现简单的tcp通信聊天工具目录结构: pro文件中添加: 1. tcp_server :1.1 服务器端头文件/******app.h ******/#ifndef APP_H#define APP_H#include #include //*#include //*#include //*QT_BEGIN_NAMESPACEnamespace Ui { class app; }QT_END...
使用Qt在Linux环境下获取路由器公网IP的实现方法
本文还有配套的精品资源,点击获取 简介:本文介绍如何使用Qt框架在Linux系统中获取设备的公网IP地址,主要针对友善之臂Tiny6410开发板。首先介绍了Qt框架,它是一个跨平台的应用程序开发框架,提供了丰富的Linux系统交互API,包括网络编程。接着详细说明了获取公网IP的步骤,包括创建QNetworkAccessManager实例,定义请求URL,发起GET请求,连...
QT通过TCP协议传输文件
常用的网络协议分为TCP和UDP两种,两种方式各有优缺点,其中TCP的主要特点是可靠,但是速度较慢(不丢包);而UDP则是不可靠传输,但速度快(可能丢包)。今天主要介绍的就是通过QT框架和TCP协议实现简单的文件传输。
Linux qt5 socket(TCP)编程
1_server.cpp #include <QWidget> #include <QTcpServer> //监听套接字 #include <QTcpSocket> //通信套接字 namespace Ui { class ServerWidget; } class ServerWidget : public QWidget { Q_OBJEC...
Miniconda3迁移(附图详细过程)
服务器上目录占满,想要将conda迁移到其他目录下的操作方法,详细教程。
【window环境、Linux环境、QT三种方法实现TCP通信】
大多数项目都在Linux系列的操作系统下开发服务器端,而多数客户端是在Windows平台下开发的。不仅如此,有时应用程序还需要在两个平台之间相互切换。因此,学习套接字编程的过程中,有必要兼顾Windows和Linux两大平台。另外,这两大平台下的套接字编程非常类似,如果把其中相似的部分放在一起讲解,将大大提高学习效率。只要理解好其中一个平台下的网络编程方法,就很容易通过分析差异掌握另一平台。因为不论什么方式实现,底层的逻辑都是完全一致的。
光模块组成
时钟恢复电路(Clock Data Recovery,简称CDR)是光模块中的关键组成部分,CDR的作用主要是从接收到的信号中提取出数据序列,并且恢复出与数据序列相对应的时钟时序信号,从而还原接收到的具体信息。因为光信号传输至一定距离的时候,通常是长距离传输,其波形会出现一定程度的失真,接收端接收到的信号是一个个长短不一的脉冲信号,这个时候在接收端,我们就无法得到我们需要的数据。所以,这个时候就需要有信号的再生,信号的再生功能为再放大、再整形和再定时,其中的再定时指的就是CDR时钟数据恢复。
思科模拟器-实验16:三层交换 VLAN 互访配置
【实验内容】 (1)按实验线路连接图进行连接。按照实验线路连接图分别配置各台计算机IP 地 址。 (2) 按照实验线路连接图,在SW1和SW2上分别完成VLAN配置,并在VLAN中添加相应的端口成员,同时配置Trunk端口。同时测试各计算机之间是否可以相互ping 通。 Switch>en Switch#config t Enter configuration commands, one per line. End with CNTL/Z. Switch(config)#vlan 10 Switc
Qt项目实战--网络编程简单BC端聊天系统
基于TCP的客户端聊天系统,客户端连接服务器ip成功后,即可与服务器之间通讯。 QAbstractSocket类提供了所有套接字类型通用的基本功能。AbstractSocket是QTcpSocket和QUdpSocket的基类,包含这两个类的所有通用功能。
微软Media Creation Tool 创建工具 1.3 升级:支持全新下载安装Win11 22H2 Build 22621.525
微软 Media Creation Tool 创建工具 1.3 升级:支持全新下载安装 Win11 22H2 Build 22621.525 ISO 镜像,如果今天运行使用 Media Creation Tool,则会下载 Windows 11 2022 版本 Build 22621.525,它不会向操作系统添加任何新内容,但会修复安装问题,下面来看看详细的更新内容。
LiunxQT开发篇—QT网络编程TCP实现(三)客户端代码
需要包含三个头文件 #include <QTcpServer> #include <QTcpSocket> #include <QString> 需要添加一个模块 QT += core gui network 使用到了一个类(QTcpSocket) QTcpSocket Class 声明一个对象 QTcpSocket *tcpSocket; 涉及到的信号: tcpSocket: connected()(This signal is emitted a
Unity热更实战:用YooAsset+HybridCLR实现小游戏资源与代码双更新(含避坑清单)
本文详细介绍了Unity小游戏开发中如何通过YooAsset与HybridCLR实现资源与代码双热更新方案。内容涵盖环境配置、架构设计、微信小游戏专项优化、热更代码工程化实践及真机调试技巧,帮助开发者解决审核周期长、紧急修复等痛点,提升更新效率与稳定性。
【ESD专题】从原理上分析TVS管PCB Layout的经验法则
我们常常会听到的一些经验法则,按这些经验法则去做,一般也不会有什么问题,但是到底是为什么呢? 没有从原理上分析和证明的时候,往往在Layout之后还要担心实际测试结果怎么样。或是在实际测试出问题后,根本无法进行分析,难道说修改一个版本就好了?那要从哪里修改呢?也无从下手呀。...
LiunxQT开发篇—QT网络编程TCP实现(二)服务端代码
需要包含三个头文件 #include <QTcpServer> #include <QTcpSocket> #include <QString> 需要添加一个模块 QT += core gui network 使用到了两个类(QTcpServer、QTcpSocket) QTcpServer Class QTcpSocket Class 声明两个对象 QTcpServer *tcpServer; QTcpSocket *tcpSocket; 涉及到的
Spring Boot Jar包加密实战:用ClassFinal与Jasypt打造代码安全堡垒
Spring Boot代码加密与配置保护方案 针对Spring Boot项目源码和配置易被反编译的风险,本文提出ClassFinal字节码加密+Jasypt配置加密的组合方案。ClassFinal通过Maven插件对核心代码加密,运行时需JavaAgent加载,反编译后仅保留空方法体;Jasypt则采用强加密算法保护敏感配置。方案优势包括: 双重保护:ClassFinal加密业务逻辑,Jasypt加密数据库密码等配置 灵活部署:支持密码启动、机器绑定等安全策略 平滑集成:兼容Spring生态,动态解密结合配
【零基础学QT】【042】Qt网络框架
上传FTP文件 下载FTP文件 发送只有文本参数的Http请求 发送带文件的Http请求 下载Http文件 发送RAW格式的Http请求 发送Binary格式的Http请求 使用TcpSocket 使用UdpSocket 使用Https
禾赛激光雷达AT128P/海康相机(1):ROS环境设备驱动
sudo cp *.so /opt/MVS/lib/64/ # 复制当前文件夹中所有.so文件 到 “/opt/MVS/lib/64/” 文件中。将相应的.so文件复制到 /opt/MVS/lib/64/。我解压的是x86_64的,解压之后,打开,再解压MVS。然后在上一层,也就是选择x86_64那一层打开终端。新建一个工作空间,或者打开自己的工作空间。)包放在src内,并解压,然后编译。MVS V2.1.2下载之后解压,// 驱动代码下载到src文件里面。// 特定文件夹中打开终端。
深度学习工具包 DeepLearningToolbox
深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[](https://bitdeli.com/free "Bitdeli Badge")
Linux学习笔记(五):网络编程、QT信号与槽机制
突发疫情但挡不住我们学习的脚步,目前疫情好转,宅了将近一个多月的自己终于可以出去戴着口罩出去走走了!!! 接上 Linux学习笔记(一) Linux学习笔记(二) Linux学习笔记(三):函数、文件IO和线程 Linux学习笔记(四):信息量、同步、互斥和网络编程 文章目录复习(1)网络编程:1、服务器server接收和发送数据2、客户端client接收和发送数据(2)QT编程学习1、如何...
RU DOS版、EFI版32bit/64bit BIOS常用工具
DOS版、EFI版的RU工具,可用来查看IO、MEM、PCI、SMBIOS等资源。亲测在EFI SHELL下可用。
4、QT中的网络编程
这篇文章提供了关于Linux网络编程、TCP通信、UDP通信以及QT中的TCP通信和HTTP请求的基本概念和示例代码
复分析 阿尔福斯(Ahlfors) 第三版答案 英文
答案分为十章,有部分习题没有答案,全英文复分析阿尔福斯(Ahlfors) 第三版答案
汉书HE8,好用的汇编代码编写工具
汉书HE8,好用的汇编代码编写工具早期编写汇编代码所用功能强大
【linux开发-Qt】-网络编程
Qt 网络模块为我们提供了编写 TCP / IP 客户端和服务器的类。
Qt 网络编程实战
qt网络编程
基于Qt框架实现网络聊天室项目
基于Qt框架实现网络聊天室项目,主要实现群聊功能
【Qt网络】—— Qt网络编程
Qt网络编程
4736
655
3376
✦幸运刮刮乐✦
刮开赢 惊喜好礼
— 惊喜奖品抢先看 —

被折叠的 条评论
为什么被折叠?



