2 #include <gnio/gsocket.h>
3 #include <gnio/ginetsocketaddress.h>
4 #include <gnio/ginet4address.h>
6 #include <glib/gprintf.h>
7 #include <sys/socket.h>
13 accept_callback (GSocket *socket, GAsyncResult *result, gpointer data)
17 if (!g_socket_connect_finish (socket, result, &error)) {
18 g_warning (error->message);
22 g_print ("successfully connected\n");
26 int main (int argc, char *argv[])
34 loop = g_main_loop_new (NULL, FALSE);
36 socket = g_socket_new (G_SOCKET_DOMAIN_INET, G_SOCKET_TYPE_STREAM, NULL, NULL);
38 g_printf ("connecting to 127.0.0.1:31882...\n");
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);
42 g_printf ("connected!\n");
44 g_main_loop_run (loop);