X-Git-Url: http://git.cascardo.info/?p=cascardo%2Fgnio.git;a=blobdiff_plain;f=test%2Ftest-tcp-client.c;fp=test%2Ftest-tcp-client.c;h=d9c7679a42e07cea23fe2c88408dd760edaf6ed5;hp=0000000000000000000000000000000000000000;hb=6ab527e0c7a63c5ffd925120dcb8b8b6cbd6c6ca;hpb=f88a5d4f15e0bbed0746dab6778631ce44b856d0 diff --git a/test/test-tcp-client.c b/test/test-tcp-client.c new file mode 100644 index 0000000..d9c7679 --- /dev/null +++ b/test/test-tcp-client.c @@ -0,0 +1,48 @@ +#include +#include + +GMainLoop *loop; + +/* +void +accept_callback (GSocket *socket, GAsyncResult *result, gpointer data) +{ + GError *error = NULL; + + if (!g_socket_connect_finish (socket, result, &error)) { + g_warning (error->message); + return; + } + + g_print ("successfully connected\n"); +} +*/ + +int main (int argc, char *argv[]) +{ + GTcpClient *client; + GError *error = NULL; + + g_thread_init (NULL); + + g_type_init (); + + loop = g_main_loop_new (NULL, FALSE); + + client = g_tcp_client_new ("localhost", 90); + + g_print ("connecting to www.google.com:80\n"); + + if (!g_tcp_client_connect (client, NULL, &error)) { + g_warning (error->message); + return; + } + + g_print ("connected!\n"); + + g_object_unref (G_OBJECT (client)); + +// g_main_loop_run (loop); + + return 0; +}