Tomasz Jankowski writes: > [...] someone said [..] that GIOChannel may not work under the > Microsoft Windows? Is that true, or not?
It depends. If you are lucky, porting a GIOChannel-using program that works fine on Linux or some other POSIX system to Windows is just a recompilation. In reality, if you happen to use GIOChannels and related machinery in a way that doesn't work the same way in the Windows implementation, you will need some (usually minor) changes to your code. If you are specifically using GIOChannels for sockets (which I guess is the most common use for them), to port just the socket code to Windows you will at least need to ifdefify what headers you include: On Windows, include <winsock2.h> (plus possibly <ws2tcpip.h>) instead of the usual litany of <sys/types.h>, <sys/socket.h>, <netinet/in.h>, <netinet/tcp.h>, <netdb.h> etc. Next you will have to ifdefify your code as necessary for the differences in the socket APIs: At the very least, you have to change close() calls on sockets to closesocket(). And quite possibly other things as well: You cannot use read() and write() on sockets on Windows, but have to use recv() and send(). Socket calls don't set errno on Windows, instead get the error code with WSAGetLastError(). Etc. And then when you get to the GIOChannel stuff, there are differences in how the implementations behave on Unix and Windows. For instance, if you set up a watch on a GIOChannel for a socket on Windows, the socket gets put into non-blocking mode. (Well, non-blocking mode *should* be what you are using anyway on Unix too, as blocking mode kinda defeats the whole idea of using GLib main loops and watches on GIOChannels etc.) Then there might be slight differences in what callbacks you get for your watched sockets in what situations. In general, you will need to do experimentation. --tml _______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list