<?xml version="1.0" encoding="gbk"?>
<rss version="2.0">
  <channel>
    <title>曲径通幽论坛 - Examples</title>
    <link>http://www.groad.net/bbs/forum.php?mod=forumdisplay&amp;fid=72</link>
    <description>Latest 20 threads of Examples</description>
    <copyright>Copyright(C) 曲径通幽论坛</copyright>
    <generator>Discuz! Board by Comsenz Inc.</generator>
    <lastBuildDate>Mon, 25 May 2026 21:36:37 +0000</lastBuildDate>
    <ttl>60</ttl>
    <image>
      <url>http://www.groad.net/bbs/static/image/common/logo_88_31.gif</url>
      <title>曲径通幽论坛</title>
      <link>http://www.groad.net/bbs/</link>
    </image>
    <item>
      <title>下载一个文本</title>
      <link>http://www.groad.net/bbs/forum.php?mod=viewthread&amp;tid=8895</link>
      <description><![CDATA[[mw_shl_code=c,true]#include 
#include 
/* For older cURL versions you will also need 
#include 
#include 
*/
#include 

size_t write_data(void *ptr, size_t size, size_t nmemb, FILE *stream) {
    size_t written = fwrite(ptr, size, nmemb, st ...]]></description>
      <category>Examples</category>
      <author>beyes</author>
      <pubDate>Mon, 13 Apr 2015 08:01:45 +0000</pubDate>
    </item>
    <item>
      <title>指定地址解析器(CURLOPT_RESOLVE)</title>
      <link>http://www.groad.net/bbs/forum.php?mod=viewthread&amp;tid=7885</link>
      <description><![CDATA[可以使用 CURLOPT_RESOLVE 选项指定一个域名对应的 IP，而不是通过已知的地址解析器，如 DNS。


测试代码：
[mw_shl_code=cpp,true]#include 
#include 
#include 
#include 


int main(void)
{
        CURL *curl;
        CURLcode res;


        struct curl_sli ...]]></description>
      <category>Examples</category>
      <author>beyes</author>
      <pubDate>Tue, 09 Jul 2013 12:19:19 +0000</pubDate>
    </item>
    <item>
      <title>如何在curl_easy_setopt中设定hosts</title>
      <link>http://www.groad.net/bbs/forum.php?mod=viewthread&amp;tid=7882</link>
      <description><![CDATA[如何在curl_easy_setopt中设定hosts，假设要访问http://aa.com/b/c接口，如何绑定172.65.12.151这样的ip。]]></description>
      <category>Examples</category>
      <author>su_hongfei</author>
      <pubDate>Tue, 09 Jul 2013 09:00:04 +0000</pubDate>
    </item>
    <item>
      <title>select 多路复用在 socket 编程中的应用</title>
      <link>http://www.groad.net/bbs/forum.php?mod=viewthread&amp;tid=7529</link>
      <description><![CDATA[在网上看到一篇利用 select() 完成单进程多用户连接的文章，它很好的展示了 select() 多路复用在 socket 编程中应用的问题。

代码出处：http://blog.csdn.net/xluren/article/details/8045230

该代码实现了一个简单的服务器端，该服务器并没有像往常一样在客户端连接 ...]]></description>
      <category>Examples</category>
      <author>beyes</author>
      <pubDate>Mon, 03 Dec 2012 05:14:25 +0000</pubDate>
    </item>
    <item>
      <title>【C语言】在 curl 中保存获取的页面内容</title>
      <link>http://www.groad.net/bbs/forum.php?mod=viewthread&amp;tid=7345</link>
      <description><![CDATA[一般情况下，使用 curl 获取一个页面时，所获取的页面内容是输出到标准输出的，如果是在 shell 里，那么容易处理该情况，即只需要把这些输出从定向到一个文本里就行。但是如果在 C 语言中，想要保存获取的数据，那么就需要用到 curl_easy_setopt()&#160;&#160;函数里的  ...]]></description>
      <category>Examples</category>
      <author>beyes</author>
      <pubDate>Tue, 14 Aug 2012 03:24:31 +0000</pubDate>
    </item>
    <item>
      <title>FTP 文件上传</title>
      <link>http://www.groad.net/bbs/forum.php?mod=viewthread&amp;tid=4023</link>
      <description><![CDATA[在下面的 FTP 文件上传的例子中，主要涉及 CURLOPT_READFUNCTION ，CURLOPT_READDATA ，CURLOPT_INFILESIZE_LARGE 以及 CURLOPT_UPLOAD 这几个参数的设置。关于这几个参数的介绍可参考：http://www.groad.net/bbs/read.php?tid-1642.html

测试代码：
[mw_shl_code=cpp, ...]]></description>
      <category>Examples</category>
      <author>beyes</author>
      <pubDate>Thu, 07 Jul 2011 04:32:53 +0000</pubDate>
    </item>
    <item>
      <title>传输与执行 FTP 命令</title>
      <link>http://www.groad.net/bbs/forum.php?mod=viewthread&amp;tid=3987</link>
      <description><![CDATA[执行 FTP 或 SFTP 命令主要使用两个选项：CURLOPT_QUOTE 和 CURLOPT_POSTQUOTE ，关于这两个选项的区别说明可参考：http://www.groad.net/bbs/read.php?tid-1642.html

下面代码会将 FTP 某个目录下的 u.php 文件命名为 u2.php ，并且还会建立一个名为 beyes 的目录。多 ...]]></description>
      <category>Examples</category>
      <author>beyes</author>
      <pubDate>Mon, 04 Jul 2011 10:35:19 +0000</pubDate>
    </item>
    <item>
      <title>FTP 下载</title>
      <link>http://www.groad.net/bbs/forum.php?mod=viewthread&amp;tid=3981</link>
      <description><![CDATA[下面代码演示从 FTP 下载一个文件。FTP 地址，登录用户，密码以及文件的路径信息均再命令行中给出。

实际上，对于 curl 来说，用户很多使用无需关心什么什么协议，如 HTTP，FTP 等都由 Curl 库来识别，我们更多要做的是用好那些设置参数。

代码中，主要用到两个参数， ...]]></description>
      <category>Examples</category>
      <author>beyes</author>
      <pubDate>Sun, 03 Jul 2011 11:41:27 +0000</pubDate>
    </item>
    <item>
      <title>使用 curl 模拟网页另存为</title>
      <link>http://www.groad.net/bbs/forum.php?mod=viewthread&amp;tid=3967</link>
      <description><![CDATA[在使用命令行时可以用 -o 选项将网页另存为到本地，下面将用两种方法模拟这种行为。

1. 使用 CURLOPT_WRITEFUNCTION 选项
[mw_shl_code=cpp,true]
#include 
#include 
#include 
#include 


FILE *fp;

size_t save_html (void *ptr, size_t size, size_t nmemb, voi ...]]></description>
      <category>Examples</category>
      <author>beyes</author>
      <pubDate>Fri, 01 Jul 2011 17:47:57 +0000</pubDate>
    </item>
    <item>
      <title>测试下载速度</title>
      <link>http://www.groad.net/bbs/forum.php?mod=viewthread&amp;tid=3935</link>
      <description><![CDATA[下面代码演示了如何使用 curl 获取下载文件大小，以及下载总耗时，并在最后计算出平均的下载速度：

[mw_shl_code=cpp,true]#include 
#include 
#include 
#include 

#include 
#include 

//下载文件地址
#define DURL \&quot;http://www.yuquan.com/music/yuquan/03reai/0 ...]]></description>
      <category>Examples</category>
      <author>beyes</author>
      <pubDate>Thu, 30 Jun 2011 03:56:33 +0000</pubDate>
    </item>
    <item>
      <title>简单 POST 留言</title>
      <link>http://www.groad.net/bbs/forum.php?mod=viewthread&amp;tid=3909</link>
      <description><![CDATA[使用 curl 明令 post 一个留言到留言本是比较简单的。这里演示用编程的方法来实现简单的 post 。实验环境可在百度上查找，我这里找一个 http://wange.im/guestbook/ 的网址(呵呵，免费给这个网址做个外链 ^_^) 。

这里，从地址栏里并没有完整的网页名称，只是显示了一 ...]]></description>
      <category>Examples</category>
      <author>beyes</author>
      <pubDate>Mon, 27 Jun 2011 03:34:57 +0000</pubDate>
    </item>
    <item>
      <title>批量下载百度搜索结果页</title>
      <link>http://www.groad.net/bbs/forum.php?mod=viewthread&amp;tid=1753</link>
      <description><![CDATA[程序说明：
这是一个朋友需要用(UniBI ?)，所以简单写了一个。程序的作用是，通过在命令行中指定百度关键字，然后定义要下载的结果页的页数。程序运行后，会自动下载所有的搜索结果页，严格的说，不是所有，为了方便起见，对百度知道，贴吧这些网页不做收集。程序代码如 ...]]></description>
      <category>Examples</category>
      <author>beyes</author>
      <pubDate>Sun, 11 Apr 2010 14:02:13 +0000</pubDate>
    </item>
    <item>
      <title>简单聊天程序</title>
      <link>http://www.groad.net/bbs/forum.php?mod=viewthread&amp;tid=1729</link>
      <description><![CDATA[程序说明：
使用 TCP 实现简单聊天程序，这个程序的缺点是必须按照特定顺序操作，即一收一发或一发一收。

服务器端代码：
 

客户端代码：
 
说明：
在服务器端，可以在命令行中指定端口，否则默认用 8888 。接着掉用 listen() 函数进行监听，不失败的话，就会用 accep ...]]></description>
      <category>Examples</category>
      <author>beyes</author>
      <pubDate>Mon, 05 Apr 2010 06:26:13 +0000</pubDate>
    </item>
    <item>
      <title>简单 UDP 点对点通信实例</title>
      <link>http://www.groad.net/bbs/forum.php?mod=viewthread&amp;tid=1715</link>
      <description><![CDATA[程序说明：
程序使用 AF_INET 协议实现 UDP 点对点通信，即数据传输方式为 UDP 数据报方式，主要功能是发送端向接收端发送一条 \&quot;hello world“ 消息。使用时，接收端先运行。

接收端源码：


发送端源代码：


运行与输出：
接收端先运行：

发送端发送数据：

在发送 ...]]></description>
      <category>Examples</category>
      <author>beyes</author>
      <pubDate>Sat, 03 Apr 2010 08:04:56 +0000</pubDate>
    </item>
    <item>
      <title>本地通信实例(AF_UNIX)</title>
      <link>http://www.groad.net/bbs/forum.php?mod=viewthread&amp;tid=1709</link>
      <description><![CDATA[程序说明：
程序里包含服务端和客户端两个程序，它们之间使用 AF_UNIX 实现本机数据流通信。使用 AF_UNIX 域实际上是使用本地 socket 文件来通信。

服务器端代码：


客户端代码：


程序说明：
先运行服务器端，然后再运行客户端可以在两边同时看到输出。服务器端先运 ...]]></description>
      <category>Examples</category>
      <author>beyes</author>
      <pubDate>Thu, 01 Apr 2010 15:16:02 +0000</pubDate>
    </item>
    <item>
      <title>直接 POST 到静态页</title>
      <link>http://www.groad.net/bbs/forum.php?mod=viewthread&amp;tid=1667</link>
      <description><![CDATA[说明：
Apache、IIS、Nginx等绝大多数web服务器，都不允许静态文件响应POST请求，否则会返回“HTTP/1.1 405 Method not allowed”错误。这里演示演示 curl 的示例程序，可以看看是不是这样子。

程序代码：
 
 
运行测试：

上面就是 POST 后被服务器返回的消息，说明服 ...]]></description>
      <category>Examples</category>
      <author>beyes</author>
      <pubDate>Wed, 24 Mar 2010 11:55:48 +0000</pubDate>
    </item>
    <item>
      <title>curl 基本函数使用框架</title>
      <link>http://www.groad.net/bbs/forum.php?mod=viewthread&amp;tid=1641</link>
      <description><![CDATA[程序代码：

编译链接与生成：


运行与输出：

从上面可以看到，我的论坛空间是用了一个 *.html 做了首页跳转的。

程序说明：
一开始调用了 curl_easy_init() 函数进行了初始化。如果成功初始化，则调用 curl_easy_setopt() 来设置一个需要访问的 URL ，最后使用 curl ...]]></description>
      <category>Examples</category>
      <author>beyes</author>
      <pubDate>Fri, 19 Mar 2010 13:42:04 +0000</pubDate>
    </item>
    <item>
      <title>简单日期服务器与客户端连接</title>
      <link>http://www.groad.net/bbs/forum.php?mod=viewthread&amp;tid=1407</link>
      <description><![CDATA[程序功能：
服务器端给客户端提供时间信息服务。
服务器端代码：
 
程序说明：
指定 IP 地址为 INADDR_ANY，这样就允许服务器在任意接口上接受客户连接(假定服务器主机有多个接口)。
在 socket() 函数创建套接口后，，通过 listen() 函数将此套接口变换成一个监听套接口 ...]]></description>
      <category>Examples</category>
      <author>beyes</author>
      <pubDate>Wed, 09 Dec 2009 05:39:06 +0000</pubDate>
    </item>
    <item>
      <title>Linux 下的 ARP 欺骗程序</title>
      <link>http://www.groad.net/bbs/forum.php?mod=viewthread&amp;tid=1247</link>
      <description><![CDATA[作者：wojiaohensen
  
[hr]Usage:]]></description>
      <category>Examples</category>
      <author>beyes</author>
      <pubDate>Mon, 12 Oct 2009 05:35:44 +0000</pubDate>
    </item>
    <item>
      <title>Arp Sniffer在linux下面的具体实现</title>
      <link>http://www.groad.net/bbs/forum.php?mod=viewthread&amp;tid=1107</link>
      <description><![CDATA[*============================================================================
 Coder:&#160; Paris-ye
 Released on: 1/9/2003
 Test on: redhat 9.0
 Information:
 This is a arp spoof sniffer.
 W ;ether_type = htons(ETHERTYPE_ARP);
 arph-&gt;;ar_hrd = htons ...]]></description>
      <category>Examples</category>
      <author>beyes</author>
      <pubDate>Mon, 31 Aug 2009 01:13:47 +0000</pubDate>
    </item>
  </channel>
</rss>