Remove the async stuff per IRC discussion
[cascardo/gnio.git] / test / test-client.c
1 #include <gio/gio.h>
2 #include <gnio/gsocket.h>
3 #include <gnio/ginetsocketaddress.h>
4 #include <gnio/ginet4address.h>
5 #include <glib.h>
6 #include <glib/gprintf.h>
7 #include <sys/socket.h>
8
9 GMainLoop *loop;
10
11 /*
12 void
13 accept_callback (GSocket *socket, GAsyncResult *result, gpointer data)
14 {
15         GError *error = NULL;
16
17         if (!g_socket_connect_finish (socket, result, &error)) {
18                 g_warning (error->message);
19                 return;
20         }
21
22         g_print ("successfully connected\n");
23 }
24 */
25
26 int main (int argc, char *argv[])
27 {
28         GSocket *socket;
29
30         g_thread_init (NULL);
31
32         g_type_init ();
33
34         loop = g_main_loop_new (NULL, FALSE);
35
36         socket = g_socket_new (G_SOCKET_DOMAIN_INET, G_SOCKET_TYPE_STREAM, NULL, NULL);
37
38         g_printf ("connecting to 127.0.0.1:31882...\n");
39
40         g_socket_connect (socket, G_SOCKET_ADDRESS (g_inet_socket_address_new (G_INET_ADDRESS (g_inet4_address_from_string ("127.0.0.1")), 31882)), NULL);
41
42         g_printf ("connected!\n");
43
44         g_main_loop_run (loop);
45
46         return 0;
47 }