summaryrefslogtreecommitdiff
path: root/tests/dns-wait-test.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/dns-wait-test.c')
-rw-r--r--tests/dns-wait-test.c55
1 files changed, 55 insertions, 0 deletions
diff --git a/tests/dns-wait-test.c b/tests/dns-wait-test.c
new file mode 100644
index 0000000..224368c
--- /dev/null
+++ b/tests/dns-wait-test.c
@@ -0,0 +1,55 @@
+/* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- */
+
+/* Lac - Library for asynchronous communication
+ * Copyright (C) 2003 S�ren Sandmann (sandmann@daimi.au.dk)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+#include <lac.h>
+#include <sys/socket.h>
+#include <sys/types.h>
+#include <netinet/tcp.h>
+#include <string.h>
+
+static gboolean
+timeout (gpointer data)
+{
+ LacActivity activity = data;
+ g_print ("hej\n");
+ lac_activity_cancel (activity);
+ return FALSE;
+}
+
+int
+main (int argc, char *argv[])
+{
+ LacAddress *addr;
+ LacActivity activity;
+ int id;
+
+ if (argc < 2)
+ return 0;
+
+ id = g_timeout_add (10, lac_activity_cancel, activity);
+ addr = lac_address_new_from_name_wait (argv[1], &activity, NULL);
+
+ if (addr)
+ g_print ("address: %s\n", lac_address_to_string (addr));
+ else
+ g_print ("canceled\n");
+
+ return 0;
+}