想了解更多关于开源的小白内容,请访问:
51CTO 开源基础软件社区
https://ost.51cto.com
在《#跟着小白一起学鸿蒙# [二] 第一个OpenHarmony程序》我们熟悉了如何在开源鸿蒙开发应用,起学并通过hdc工具拷贝至开发板运行。鸿蒙但是小白那时候我们只是打印了最简单的hello world,接下来我们就讲开发最常用的起学部分,一个简单的鸿蒙http客户端;
在浏览器输入www.baidu.com然后回车即可看到浏览器显示了百度的页面,按F12可以看到具体内容:
上图里我们可以看到在请求的url是www.baidu.com,请求的方法是GET,服务器的IP地址是180.101.49.14:443(https,若是http就是80)。
此样例参考小熊派设计,使用小熊派HM_Micro开发板进行验证。
graph LR
建立build.gn --> 建立helloworld.c --> 添加httpget --> 添加httppost --> 验证
建立Build.gn。
import("//build/lite/config/component/lite_component.gni")
executable("hello_world_lib") {
output_name = "hello_world"
sources = [ "hello_world.c" ]
include_dirs = []
defines = []
cflags_c = []
ldflags = []
}
lite_component("my_app") {
features = [
":hello_world_lib",
]
}
建立helloworld.c。
#include <stdio.h>
int main(int argc, char **argv)
{
printf("\n(责任编辑:时尚)
Cobar提出的一种在分库场景下对Order By / Limit 的优化
四川阿坝州提高孤儿基本生活最低养育标准 2022年1月起执行