Re: Threads, sockets and windows



Vladimir writes:
 > Can I just use g_io_channel_unix_new(socket) to create GIOChannel for
 > windows socket ?

Not reliably. The same small integer might be both a valid file
descriptor and a socket, and there is no way for
g_io_channel_unix_new() to know which one you mean.

Use g_io_channel_win32_new_fd() or g_io_channel_win32_socket().

(Vladimir presumably knows this, but for people who are wondering: In
Win32, "file descriptors" (the integers that open() and dup() return)
are implemented in the C library, not the kernel. Sockets again (the
integers that socket() and accept() return) are implemented by the
kernel. They are not related at all, the C library knows nothing about
sockets, and the kernel knows nothing about C file descriptors.)

--tml




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