当前位置: 首页 > news >正文

Hi3861 OpenHarmony嵌入式应用入门--TCP Server

本篇使用的是lwip编写tcp服务端。需要提前准备好一个PARAM_HOTSPOT_SSID宏定义的热点,并且密码为PARAM_HOTSPOT_PSK

LwIP简介

LwIP是什么?

A Lightweight TCP/IP stack 一个轻量级的TCP/IP协议栈

详细介绍请参考LwIP项目官网:lwIP - A Lightweight TCP/IP stack - Summary [Savannah]

LwIP在openharmony上的应用情况

目前,openharmony源码树有两份LwIP:

  1. third_party/lwip
    • 源码形式编译
    • 供liteos-a内核使用
    • 还有一部分代码在kernel/liteos_a中,一起编译
  1. vendor/hisi/hi3861/hi3861/third_party/lwip_sack
    • hi3861-sdk的一部分
    • 静态库形式编译
    • 不可修改配置
    • 可以查看当前配置(vend

LwIP Socket API编程主要是6个步骤:

创建Tcp Server Socket:socket

绑定指定的IP和Port:bind

设置socket为监听状态:listen

阻塞方式等待client连接:accept

阻塞方式receive client的消息:recv

调用send发送消息给TCP Client

修改网络参数

在Hi3861开发板上运行上述四个测试程序之前,需要根据你的无线路由、Linux系统IP修改 net_params.h文件的相关代码:

  • PARAM_HOTSPOT_SSID 修改为你的热点名称
  • PARAM_HOTSPOT_PSK 修改为你的热点密码;

代码编写

修改D:\DevEcoProjects\test\src\vendor\rtplay\rt_hi3861\demo\BUILD.gn文件

# Copyright (c) 2023 Beijing HuaQing YuanJian Education Technology Co., Ltd
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# 
#    http://www.apache.org/licenses/LICENSE-2.0
# 
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License. import("//build/lite/config/component/lite_component.gni")lite_component("demo") {features = [#"base_00_helloworld:base_helloworld_example",#"base_01_led:base_led_example",#"base_02_loopkey:base_loopkey_example",#"base_03_irqkey:base_irqkey_example",#"base_04_adc:base_adc_example",#"base_05_pwm:base_pwm_example",#"base_06_ssd1306:base_ssd1306_example",#"kernel_01_task:kernel_task_example",#"kernel_02_timer:kernel_timer_example",#"kernel_03_event:kernel_event_example",#"kernel_04_mutex:kernel_mutex_example",#"kernel_05_semaphore_as_mutex:kernel_semaphore_as_mutex_example",#"kernel_06_semaphore_for_sync:kernel_semaphore_for_sync_example",#"kernel_07_semaphore_for_count:kernel_semaphore_for_count_example",#"kernel_08_message_queue:kernel_message_queue_example",#"wifi_09_hotspot:wifi_hotspot_example",#"wifi_10_sta:wifi_sta_example","tcp_11_server:tcp_server_example",]
}

创建D:\DevEcoProjects\test\src\vendor\rtplay\rt_hi3861\demo\tcp_11_server文件夹

文件夹中创建D:\DevEcoProjects\test\src\vendor\rtplay\rt_hi3861\demo\tcp_11_server\BUILD.gn文件

#Copyright (C) 2021 HiHope Open Source Organization .
#Licensed under the Apache License, Version 2.0 (the "License");
#you may not use this file except in compliance with the License.
#You may obtain a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
#Unless required by applicable law or agreed to in writing, software
#distributed under the License is distributed on an "AS IS" BASIS,
#WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#See the License for the specific language governing permissions and
#
#limitations under the License.static_library("tcp_server_example") {# uncomment one of following line, to enable one test:sources = ["tcp_server_example.c"]sources += ["wifi_connecter.c"]include_dirs = ["//utils/native/lite/include","//kernel/liteos_m/kal","//foundation/communication/wifi_lite/interfaces/wifiservice",]
}

添加了wifi_connecter.c文件的编译,这个文件中有链接wifi的函数。

文件夹中创建D:\DevEcoProjects\test\src\vendor\rtplay\rt_hi3861\demo\tcp_11_server\net_common.h文件,文件主要引入一些头文件。

/** Copyright (C) 2021 HiHope Open Source Organization .* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at**     http://www.apache.org/licenses/LICENSE-2.0** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.* See the License for the specific language governing permissions and** limitations under the License.*/#ifndef NET_COMMON_H
#define NET_COMMON_H// __arm__ and __aarch64__ for HarmonyOS with liteos-a kernel
// __i386__ and __x86_64__ for Unix like OS
#if defined(__arm__) || defined(__aarch64__) || defined(__i386__) || defined(__x86_64__)
#define HAVE_BSD_SOCKET 1
#else
#define HAVE_BSD_SOCKET 0
#endif#if defined(__riscv) // for wifiiot(HarmonyOS on Hi3861 with liteos-m kernel)
#define HAVE_LWIP_SOCKET 1
#else
#define HAVE_LWIP_SOCKET 0
#endif#if HAVE_BSD_SOCKET
#include <sys/types.h>  // for AF_INET SOCK_STREAM
#include <sys/socket.h> // for socket
#include <netinet/in.h> // for sockaddr_in
#include <arpa/inet.h> // for inet_pton
#elif HAVE_LWIP_SOCKET
#include "lwip/sockets.h"
#ifndef close
#define close(fd) lwip_close(fd)
#endif
#else
#error "Unknow platform!"
#endif#endif  // NET_COMMON_H

文件夹中创建D:\DevEcoProjects\test\src\vendor\rtplay\rt_hi3861\demo\tcp_11_server\wifi_connecter.h文件,该头文件包含wifi连接的宏。

/** Copyright (C) 2021 HiHope Open Source Organization .* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at**     http://www.apache.org/licenses/LICENSE-2.0** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.* See the License for the specific language governing permissions and** limitations under the License.*/#ifndef WIFI_CONNECTER_H
#define WIFI_CONNECTER_H#include "wifi_device.h"#ifndef PARAM_HOTSPOT_SSID
#define PARAM_HOTSPOT_SSID "HarmonyOS"   // your AP SSID
#endif#ifndef PARAM_HOTSPOT_PSK
#define PARAM_HOTSPOT_PSK  "1234567890"  // your AP PSK
#endif#ifndef PARAM_HOTSPOT_TYPE
#define PARAM_HOTSPOT_TYPE WIFI_SEC_TYPE_PSK // defined in wifi_device_config.h
#endif#ifndef PARAM_SERVER_ADDR
#define PARAM_SERVER_ADDR "192.168.1.100" // your PC IP address
#endif#ifndef PARAM_SERVER_PORT
#define PARAM_SERVER_PORT 5678
#endifint ConnectToHotspot(WifiDeviceConfig* apConfig);void DisconnectWithHotspot(int netId);#endif  // WIFI_CONNECTER_H

文件夹中创建D:\DevEcoProjects\test\src\vendor\rtplay\rt_hi3861\demo\tcp_11_server\wifi_connecter.c文件,wifi连接的实现。

/** Copyright (C) 2021 HiHope Open Source Organization .* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at**     http://www.apache.org/licenses/LICENSE-2.0** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.* See the License for the specific language governing permissions and** limitations under the License.*/#include "wifi_device.h"
#include "cmsis_os2.h"#include "lwip/netifapi.h"
#include "lwip/api_shell.h"#define IDX_0          0
#define IDX_1          1
#define IDX_2          2
#define IDX_3          3
#define IDX_4          4
#define IDX_5          5
#define DELAY_TICKS_10     (10)
#define DELAY_TICKS_100    (100)static void PrintLinkedInfo(WifiLinkedInfo* info)
{if (!info) return;static char macAddress[32] = {0};unsigned char* mac = info->bssid;snprintf(macAddress, sizeof(macAddress), "%02X:%02X:%02X:%02X:%02X:%02X",mac[IDX_0], mac[IDX_1], mac[IDX_2], mac[IDX_3], mac[IDX_4], mac[IDX_5]);printf("bssid: %s, rssi: %d, connState: %d, reason: %d, ssid: %s\r\n",macAddress, info->rssi, info->connState, info->disconnectedReason, info->ssid);
}static volatile int g_connected = 0;static void OnWifiConnectionChanged(int state, WifiLinkedInfo* info)
{if (!info) return;printf("%s %d, state = %d, info = \r\n", __FUNCTION__, __LINE__, state);PrintLinkedInfo(info);if (state == WIFI_STATE_AVALIABLE) {g_connected = 1;} else {g_connected = 0;}
}static void OnWifiScanStateChanged(int state, int size)
{printf("%s %d, state = %X, size = %d\r\n", __FUNCTION__, __LINE__, state, size);
}static WifiEvent g_defaultWifiEventListener = {.OnWifiConnectionChanged = OnWifiConnectionChanged,.OnWifiScanStateChanged = OnWifiScanStateChanged
};static struct netif* g_iface = NULL;err_t netifapi_set_hostname(struct netif *netif, char *hostname, u8_t namelen);int ConnectToHotspot(WifiDeviceConfig* apConfig)
{WifiErrorCode errCode;int netId = -1;errCode = RegisterWifiEvent(&g_defaultWifiEventListener);printf("RegisterWifiEvent: %d\r\n", errCode);errCode = EnableWifi();printf("EnableWifi: %d\r\n", errCode);errCode = AddDeviceConfig(apConfig, &netId);printf("AddDeviceConfig: %d\r\n", errCode);g_connected = 0;errCode = ConnectTo(netId);printf("ConnectTo(%d): %d\r\n", netId, errCode);while (!g_connected) { // wait until connect to APosDelay(DELAY_TICKS_10);}printf("g_connected: %d\r\n", g_connected);g_iface = netifapi_netif_find("wlan0");if (g_iface) {err_t ret = 0;char* hostname = "rtplay";ret = netifapi_set_hostname(g_iface, hostname, strlen(hostname));printf("netifapi_set_hostname: %d\r\n", ret);ret = netifapi_dhcp_start(g_iface);printf("netifapi_dhcp_start: %d\r\n", ret);osDelay(DELAY_TICKS_100); // wait DHCP server give me IP
#if 1ret = netifapi_netif_common(g_iface, dhcp_clients_info_show, NULL);printf("netifapi_netif_common: %d\r\n", ret);
#else// 下面这种方式也可以打印 IP、网关、子网掩码信息ip4_addr_t ip = {0};ip4_addr_t netmask = {0};ip4_addr_t gw = {0};ret = netifapi_netif_get_addr(g_iface, &ip, &netmask, &gw);if (ret == ERR_OK) {printf("ip = %s\r\n", ip4addr_ntoa(&ip));printf("netmask = %s\r\n", ip4addr_ntoa(&netmask));printf("gw = %s\r\n", ip4addr_ntoa(&gw));}printf("netifapi_netif_get_addr: %d\r\n", ret);
#endif}return netId;
}void DisconnectWithHotspot(int netId)
{if (g_iface) {err_t ret = netifapi_dhcp_stop(g_iface);printf("netifapi_dhcp_stop: %d\r\n", ret);}WifiErrorCode errCode = Disconnect(); // disconnect with your APprintf("Disconnect: %d\r\n", errCode);errCode = UnRegisterWifiEvent(&g_defaultWifiEventListener);printf("UnRegisterWifiEvent: %d\r\n", errCode);RemoveDevice(netId); // remove AP configprintf("RemoveDevice: %d\r\n", errCode);errCode = DisableWifi();printf("DisableWifi: %d\r\n", errCode);
}

文件夹中创建D:\DevEcoProjects\test\src\vendor\rtplay\rt_hi3861\demo\tcp_11_server\tcp_server_example.c文件

/** Copyright (C) 2021 HiHope Open Source Organization .* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at**     http://www.apache.org/licenses/LICENSE-2.0** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.* See the License for the specific language governing permissions and** limitations under the License.*/#include <errno.h>
#include <stdio.h>
#include <string.h>
// #include <stddef.h>
#include <unistd.h>
#include "ohos_init.h"
#include "cmsis_os2.h"#include "net_common.h"
#include "wifi_connecter.h"#define DELAY_1S  (1)
#define STACK_SIZE         (10240)
#define DELAY_TICKS_10     (10)
#define DELAY_TICKS_100    (100)static char request[128] = "";
void TcpServerTest(void)
{WifiDeviceConfig config = {0};// 准备AP的配置参数// strcpy(config.ssid, PARAM_HOTSPOT_SSID);// strcpy(config.preSharedKey, PARAM_HOTSPOT_PSK);strcpy_s(config.ssid, WIFI_MAX_SSID_LEN, PARAM_HOTSPOT_SSID);strcpy_s(config.preSharedKey, WIFI_MAX_KEY_LEN, PARAM_HOTSPOT_PSK);config.securityType = PARAM_HOTSPOT_TYPE;osDelay(DELAY_TICKS_10);int netId = ConnectToHotspot(&config);ssize_t retval = 0;int backlog = 1;int sockfd = socket(AF_INET, SOCK_STREAM, 0); // TCP socketint connfd = -1;struct sockaddr_in clientAddr = {0};socklen_t clientAddrLen = sizeof(clientAddr);struct sockaddr_in serverAddr = {0};serverAddr.sin_family = AF_INET;serverAddr.sin_port = htons(PARAM_SERVER_PORT);  // 端口号,从主机字节序转为网络字节序serverAddr.sin_addr.s_addr = htonl(INADDR_ANY); // 允许任意主机接入, 0.0.0.0retval = bind(sockfd, (struct sockaddr *)&serverAddr, sizeof(serverAddr)); // 绑定端口if (retval < 0) {printf("bind failed, %ld!\r\n", retval);goto do_cleanup;}printf("bind to port %hu success!\r\n", PARAM_SERVER_PORT);retval = listen(sockfd, backlog); // 开始监听if (retval < 0) {printf("listen failed!\r\n");goto do_cleanup;}printf("listen with %d backlog success!\r\n", backlog);// 接受客户端连接,成功会返回一个表示连接的 socket , clientAddr 参数将会携带客户端主机和端口信息 ;失败返回 -1// 此后的 收、发 都在 表示连接的 socket 上进行;之后 sockfd 依然可以继续接受其他客户端的连接,//  UNIX系统上经典的并发模型是“每个连接一个进程”——创建子进程处理连接,父进程继续接受其他客户端的连接//  鸿蒙liteos-a内核之上,可以使用UNIX的“每个连接一个进程”的并发模型//     liteos-m内核之上,可以使用“每个连接一个线程”的并发模型connfd = accept(sockfd, (struct sockaddr *)&clientAddr, &clientAddrLen);if (connfd < 0) {printf("accept failed, %d, %d\r\n", connfd, errno);goto do_cleanup;}printf("accept success, connfd = %d!\r\n", connfd);printf("client addr info: host = %s, port = %hu\r\n", inet_ntoa(clientAddr.sin_addr), ntohs(clientAddr.sin_port));// 后续 收、发 都在 表示连接的 socket 上进行;retval = recv(connfd, request, sizeof(request), 0);if (retval < 0) {printf("recv request failed, %ld!\r\n", retval);goto do_disconnect;}printf("recv request{%s} from client done!\r\n", request);retval = send(connfd, request, strlen(request), 0);if (retval <= 0) {printf("send response failed, %ld!\r\n", retval);goto do_disconnect;}printf("send response{%s} to client done!\r\n", request);do_disconnect:sleep(DELAY_1S);close(connfd);sleep(DELAY_1S); // for debugdo_cleanup:printf("do_cleanup...\r\n");close(sockfd);DisconnectWithHotspot(netId);
}SYS_RUN(TcpServerTest);

使用build,编译成功后,使用upload进行烧录。

相关文章:

Hi3861 OpenHarmony嵌入式应用入门--TCP Server

本篇使用的是lwip编写tcp服务端。需要提前准备好一个PARAM_HOTSPOT_SSID宏定义的热点&#xff0c;并且密码为PARAM_HOTSPOT_PSK LwIP简介 LwIP是什么&#xff1f; A Lightweight TCP/IP stack 一个轻量级的TCP/IP协议栈 详细介绍请参考LwIP项目官网&#xff1a;lwIP - A Li…...

Poker Game, Run Fast

Poker Game, Run Fast 扑克&#xff1a;跑得快 分门别类&#xff1a; 单张从小到大默认 A < 2 < 3 < 4 < 5 < 6 < 7 < 8 < 9 < 10 < J < Q < K 跑得快&#xff1a;单张从小到大 3 < 4 < 5 < 6 < 7 < 8 < 9 < 10 &…...

订单折扣金额分摊算法|代金券分摊|收银系统|积分分摊|分摊|精度问题|按比例分配|钱分摊|钱分配

一个金额分摊的算法&#xff0c;将折扣分摊按比例&#xff08;细单实收在总体的占比&#xff09;到各个细单中。 此算法需要达到以下要求&#xff1a; 折扣金额接近细单总额&#xff0c;甚至折扣金额等于细单金额&#xff0c;某些时候甚至超过细单总额&#xff0c;要保证实收不…...

Matlab中collectPlaneWave函数的应用

查看文档如下&#xff1a; 可以看出最多5个参数&#xff0c;分别是阵列对象&#xff0c;信号幅度&#xff0c;入射角度&#xff0c;信号频率&#xff0c;光速。 在下面的代码中&#xff0c;我们先创建一个3阵元的阵列&#xff0c;位置为&#xff1a;&#xff08;-1,0,0&#x…...

Linux系统的基础知识和常用命令

1、什么是Linux&#xff1f; 是一种免费使用和自由传播的类UNIX操作系统&#xff0c;其内核由林纳斯本纳第克特托瓦兹于1991年10月5日首次发布&#xff0c;它主要受到Minix和Unix思想的启发&#xff0c;是一个基于POSIX的多用户、多任务、支持多线程和多CPU的操作系统。它能运行…...

三相异步电动机的起动方法

1. 引言 2. 三相笼型异步电动机德起动方法 3. 三相绕线型异步电动机的起动方法 4. 软起动器起动 5. 参考文献 1 引言 三相异步电动机结构简单﹑价格低廉﹑运行可靠﹑维护方便&#xff0c;在工农业生产中得到了广泛应用。为使电动机能够转动起来&#xff0c;并很快达到工作转…...

【LinuxC语言】手撕Http协议之accept_request函数实现(一)

文章目录 前言accept_request函数作用accept_request实现解析方法根据不同方法进行不同操作http服务器响应格式unimplemented函数实现总结前言 在计算机网络中,HTTP协议是一种常见的应用层协议,它定义了客户端和服务器之间如何进行数据交换。在这篇文章中,我们将深入探讨Li…...

Redis Cluster 模式 的具体实施细节是什么样的?

概述 参考&#xff1a;What are Redis Cluster and How to setup Redis Cluster locally ? | by Rajat Pachauri | Medium Redis Cluster 的工作原理是将数据分布在多个节点上&#xff0c;同时确保高可用性和容错能力。以下是 Redis Cluster 运行方式的简要概述&#xff1a; …...

基于大模型的机器人控制

基于大模型的机器人控制是指利用深度学习中的大型神经网络模型来实现对机器人的精确控制。这种方法结合了深度学习的强大表征学习能力和机器人控制的实际需求&#xff0c;旨在提高机器人的自主性、灵活性和智能性。 基本原理 数据收集&#xff1a;首先&#xff0c;需要收集大量…...

在 PostgreSQL 中,如何处理数据的版本控制?

文章目录 一、使用时间戳字段进行版本控制二、使用版本号字段进行版本控制三、使用历史表进行版本控制四、使用 RETURNING 子句获取更新前后的版本五、使用数据库触发器进行版本控制 在 PostgreSQL 中&#xff0c;处理数据的版本控制可以通过多种方式实现&#xff0c;每种方式都…...

Rust 组织管理

Rust 组织管理 Rust 是一种系统编程语言&#xff0c;以其内存安全性、速度和并发性而闻名。它由 Mozilla 开发&#xff0c;并得到了一个庞大而活跃的社区的支持。Rust 的组织管理涉及多个方面&#xff0c;包括项目管理、社区参与、工具和库的维护&#xff0c;以及生态系统的整…...

vb.netcad二开自学笔记1:万里长征第一步Hello CAD!

已入门的朋友请绕行&#xff01; 今天开启自学vb.net 开发autocad&#xff0c;网上相关资料太少了、太老了。花钱买课吧&#xff0c;穷&#xff01;又舍不得&#xff0c;咬牙从小白开始摸索自学吧&#xff0c;虽然注定是踏上了一条艰苦之路&#xff0c;顺便作个自学笔记备忘!积…...

Vue的学习之数据与方法

前段期间&#xff0c;由于入职原因没有学习&#xff0c;现在已经正式入职啦&#xff0c;接下来继续加油学习。 一、数据与方法 文字备注已经在代码中&#xff0c;方便自己学习和理解 <!DOCTYPE html> <html><head><meta charset"utf-8">&l…...

刷题——在二叉树中找到最近公共祖先

在二叉树中找到两个节点的最近公共祖先_牛客题霸_牛客网 int lowestCommonAncestor(TreeNode* root, int o1, int o2) {if(root NULL) return -1;if((root->val o1) || (root->val o2)) return root->val;int left lowestCommonAncestor(root->left, o1, o2);i…...

nginx(三)—从Nginx配置熟悉Nginx功能

一、 Nginx配置文件结构 ... #全局块events { #events块... }http #http块 {... #http全局块server #server块{ ... #server全局块location [PATTERN] #location块{...}location [PATTERN] {...}}server{...}... #http全局块 …...

Python轮子:文件比较器——filecmp

原文链接&#xff1a;http://www.juzicode.com/python-module-filecmp filecmp模块可以用来比较文件或者目录。 安装和导入 filecmp是Python自带的模块&#xff0c;不需要额外安装&#xff0c;直接导入即可&#xff1a; import filecmp as fc #或者 import filecmp cmp()比较…...

uni-app组件 子组件onLoad、onReady事件无效

文章目录 导文解决方法 导文 突然发现在项目中&#xff0c;组件 子组件的onLoad、onReady事件无效 打印也出不来值 怎么处理呢&#xff1f; 解决方法 mounted() {console.log(onLoad, this.dateList);//有效// this.checkinDetails()},onReady() {console.log(onReady, this.da…...

leetcode力扣_排序问题

215.数组中的第K个最大元素 鉴于已经将之前学的排序算法忘得差不多了&#xff0c;只会一个冒泡排序法了&#xff0c;就写了一个冒牌排序法&#xff0c;将给的数组按照降序排列&#xff0c;然后取nums[k-1]就是题目要求的&#xff0c;但是提交之后对于有的示例显示”超出时间限制…...

在 .NET 8 Web API 中实现弹性

在现代 Web 开发中&#xff0c;构建弹性 API 对于确保可靠性和性能至关重要。本文将指导您使用 Microsoft.Extensions.Http.Resilience 库在 .NET 8 Web API 中实现弹性。我们将介绍如何设置重试策略和超时&#xff0c;以使您的 API 更能抵御瞬时故障。 步骤 1.创建一个新的 .…...

linux下高级IO模型

高级IO 1.高级IO模型基本概念1.1 阻塞IO1.2 非阻塞IO1.3 信号驱动IO1.4 IO多路转接1.5 异步IO 2. 模型代码实现2.1 非阻塞IO2.2 多路转接-selectselect函数介绍什么才叫就绪呢&#xff1f;demoselect特点 2.3 多路转接-pollpoll函数介绍poll优缺点demo 2.4 多路转接-epoll&…...

OpenClaw技能安装失败全解析:从依赖冲突到网络问题的系统性解决方案

1. 项目概述&#xff1a;当技能“卡住”时&#xff0c;我们遇到了什么&#xff1f;最近在折腾OpenClaw这类开源AI助手平台时&#xff0c;不少朋友都踩进了同一个坑&#xff1a;从官方市场或者第三方渠道找到了心仪的技能&#xff08;Skill&#xff09;&#xff0c;点击“安装”…...

身份证OCR识别接口接入实战:Python/Java/PHP/C#四语言代码示例与踩坑指南

#身份证OCR, #OCR接口, #API接入, #Python示例, #Java示例, #PHP示例, #踩坑指南, #石榴智能, #实名认证, #图片识别 身份证OCR识别接口接入实战&#xff1a;Python/Java/PHP/C#四语言代码示例与踩坑指南 作者&#xff1a;石榴智能技术团队 一、前言 身份证OCR识别已经不是什…...

从理论推导到代码实现:手把手教你用Python/Numpy写出守恒形式的NS方程求解器

从理论推导到代码实现&#xff1a;手把手教你用Python/Numpy写出守恒形式的NS方程求解器计算流体力学&#xff08;CFD&#xff09;的魅力在于它将抽象的数学方程转化为可执行的代码&#xff0c;让流体运动的奥秘在计算机中重现。对于已经掌握流体力学理论的中高级学习者来说&am…...

收藏必看|2026 版大厂 AI 岗位薪资曝光!普通程序员转型大模型最全指南

深夜收到大厂 HR 好友发来的内部资料&#xff0c;再三叮嘱切勿对外泄露。如今网络信息传播速度极快&#xff0c;这份 2026 年企业 AI 岗真实薪资内幕&#xff0c;也值得给广大程序员、零基础入行小白参考借鉴。 翻看完整薪资台账后&#xff0c;真切感受到当下大模型赛道的薪资差…...

物联网与云技术赋能咖啡后处理:CeriTech 的实时监控系统实践

1. 项目概述&#xff1a;用物联网与云技术重塑咖啡后处理在印尼的咖啡农场里&#xff0c;传统的发酵与干燥过程很大程度上依赖“感觉”和“经验”。一位有经验的农人可能会用手触摸、用鼻子闻&#xff0c;或者根据天气和日照时间来估算发酵是否完成、干燥是否均匀。这种方法固然…...

GitLab External Wiki代理权限绕过漏洞深度解析

1. 这个漏洞不是“修个补丁”就能完事的——它暴露的是 GitLab 权限模型里一个被长期忽视的逻辑断层GitLab 安全漏洞 CVE-2025-2614&#xff0c;光看编号容易误以为是又一个常规的越权或 XSS 类型漏洞。但我在实际复现和审计过程中发现&#xff0c;它根本不是配置疏漏或代码拼写…...

AI写的论文双率如何压到20%以下?这几款工具实测有效

毕业季、投稿季用AI写论文已经成为不少人的高效选择&#xff0c;但查重率飘红、AIGC疑似率超标两大问题&#xff0c;让很多人犯了难。2026年学术检测标准持续收紧&#xff0c;知网、维普及主流AIGC检测系统同步上线双检规则&#xff0c;两项指标均控制在20%以下才符合基本提交要…...

从零到上机:我的第一个Quest 3空间锚点应用是如何跑起来的(附完整Unity工程)

从零到上机&#xff1a;我的第一个Quest 3空间锚点应用是如何跑起来的&#xff08;附完整Unity工程&#xff09;第一次戴上Meta Quest 3时&#xff0c;那种虚拟与现实交织的震撼感至今难忘。但作为开发者&#xff0c;更让我着迷的是如何让虚拟物体在真实空间中"记住"…...

CentOS 8.5最小化安装后,这5个必做的安全与效率优化设置(附一键脚本)

CentOS 8.5最小化安装后的5个必做安全与效率优化刚完成CentOS 8.5最小化安装的系统就像一张白纸——干净但缺乏生产力。作为运维老手&#xff0c;我见过太多人跳过基础优化直接部署应用&#xff0c;结果在后续使用中频繁遇到权限混乱、软件安装慢、SSH爆破等问题。本文将分享我…...

【Veo 2提示词SOP白皮书】:从模糊意图到像素级输出的8步标准化工作流(附NASA级测试用例库)

更多请点击&#xff1a; https://intelliparadigm.com 第一章&#xff1a;Veo 2提示词工程的本质与范式跃迁 Veo 2并非单纯升级的视频生成模型&#xff0c;而是一次提示词工程范式的根本性重构——它将传统“指令式提示”&#xff08;prompt-as-command&#xff09;转向“意图…...