Connecting to a socket with a GTK application



Hi,
I build a small GTK 2.2.? application with 2 button, a text view and a text entry. With this application I want (as a client) to send en receive data from a diffrent proces through a socket. Inside my GTK application I created a function called 'client' to connect my app with the socket.

But I get this error:
   Tipnose1.c: In function `client':
Tipnose1.c:45: warning: passing arg 2 of `connect' from incompatible pointer type
When I try to compile the program.
Here is some code of the client function:

   struct sockaddr_in sniff;

   sock = socket(AF_INET, SOCK_STREAM, 0);
    sniff.sin_port = htons(SERVER_PORT);
    sniff.sin_family = AF_INET;
   c = connect(sock, &sniff, sizeof(sniff) );
fprintf(stderr, "\tRemote host address is %lx\n",ntohl ( sniff.sin_addr.s_addr ) ); But when I am NOT using the GTK-libary's (//#include <gtk/gtk.h) I do NOT have problems with connecting to socket.

How can I connect to the socket AND use the GTK library's in the same source file?

Thanks

Maarten




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]