26.01.2013 15:26, Max Kellermann пишет: > Can we somehow convert the integer file handle to a WIN32 HANDLE for > use in GPollFD?
Yes, it's possible. In theory things look simple: create event object with CreateEvent() or WSACreateEvent(), associate event with socket via WSAEventSelect(). This event would be stored in GPollFD instead of actual descriptor. The only complex thing is the need to call WSAEventSelect() everytime set of socket events (i.e. read/write/etc) changes. This could be done in prepare() function for example. > > How much is it? If it's just a few lines, why not. In practice this looks not so simple. I would like not to copy the code I don't completely understand :-) You could take a lot at it here: http://git.gnome.org/browse/glib/tree/glib/giowin32.c Important functions are: g_io_win32_prepare g_io_win32_check g_io_channel_win32_make_pollfd The only interesting case is G_IO_WIN32_SOCKET. > What is a replacement that runs on Linux (POSIX), Windows and Android? > Or shall we just roll our own? Well, I'm not expert in network programming at all, but I'd prefer to use something well-tested and documented. Each socket implementation has its own issues (especially winsock). So we might spend a lot of time in writing Yet Another Event Loop library instead of implementing features that actually relate to music playback. You named libevent last time. Do it fit our conditions? On the other-side, implementing our own event library gives the smallest possible overhead. Also it would reduce number of strong dependencies thus MPD would not be limited to platforms supported by chosen event loop library. Bonus question: actually I thought that Android provides the same networking APIs as POSIX systems since it actually uses Linux kernel. But you can prove me wrong. -- Denis ------------------------------------------------------------------------------ Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft MVPs and experts. ON SALE this month only -- learn more at: http://p.sf.net/sfu/learnnow-d2d _______________________________________________ Musicpd-dev-team mailing list Musicpd-dev-team@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/musicpd-dev-team