From 68826376ee5f47783c644c6604f4411ec747cd7e Mon Sep 17 00:00:00 2001
From: guowenxue <guowenxue@gmail.com>
Date: Fri, 14 Nov 2025 23:52:16 +0800
Subject: [PATCH] Add UDP DNS client source code

---
 project/3.dnsclient/dnsclient.c |   44 ++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 44 insertions(+), 0 deletions(-)

diff --git a/project/3.dnsclient/dnsclient.c b/project/3.dnsclient/dnsclient.c
new file mode 100644
index 0000000..4e4a173
--- /dev/null
+++ b/project/3.dnsclient/dnsclient.c
@@ -0,0 +1,44 @@
+/*********************************************************************************
+ *      Copyright:  (C) 2018 LingYun IoT Studio
+ *                  All rights reserved.
+ *
+ *       Filename:  dnsclient.c
+ *    Description:  This file is DNS client API test entry(main) file
+ *
+ *        Version:  1.0.0(10/29/2018)
+ *         Author:  Guo Wenxue <guowenxue@gmail.com>
+ *      ChangeLog:  1, Release initial version on "2018-10-28 01:38:08 PM"
+ *
+ ********************************************************************************/
+
+#include <stdio.h>
+#include <errno.h>
+#include <string.h>
+#include <time.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#include "udp_dns.h"
+
+int main(int argc,char* argv[])
+{
+    char                 *hostname;
+    char                  ipaddr[IPADDR_LEN];
+
+    if(argc != 2)
+    {
+        printf("Usage: %s [domain]\n", argv[0]);
+        return 1;
+    }
+
+    hostname=argv[1];
+
+    memset( ipaddr, 0, sizeof(ipaddr) );
+    query_dns("114.114.114.114", hostname, ipaddr, IPADDR_LEN);
+
+    printf("DNS query: %s->%s\n", hostname, ipaddr);
+
+    return 0;
+}
+
+

--
Gitblit v1.9.1