c - 如何使用 libcurl 作为服务器?

标签 c linux curl

我可以使用 curl 的函数来接收客户端 https 连接吗?我想使用 libcurl 编写服务器,我应该使用裸套接字来接受连接吗?官方文档提供了如下示例:

/* read the response */ 
for(;;)
{
  char buf[1024];

  wait_on_socket(sockfd, 1, 60000L);
  res = curl_easy_recv(curl, buf, 1024, &iolen);

  if(CURLE_OK != res)
    break;

  printf("Received %u bytes.\n", iolen);
}

但他们总是写客户端,而不是服务器...

最佳答案

来自 LIBCURL - about

libcurl is a free, open source client to get documents/files from servers, using any of the supported protocols.

它是一个客户端库,而不是 HTTPS 服务器。

关于c - 如何使用 libcurl 作为服务器?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6226068/

相关文章:

linux - 批量重命名文件

linux - WHO 命令的值在一行中返回(而不是多行)

json - Postman中Elasticsearch的不正确curl语法

链接时出现c构建错误

c - stdin、stdout 和 stderr 到标准输入和标准输出的实际分配

java - 使用 bash globing 设置 Java 命令行属性

c - "struct user* "和 "struct user *"有什么区别?

python - 提交文件时python curl的问题

php - 使用端口号制作 php curl