Re: Listening to Windows Socket events

On Nov 17, 6:39 pm, David Gravereaux <davyg...@xxxxxxxxx> wrote:
moustafan wrote:
My question is:
How to ask tcl event loop that I want it to notify me when the OS
(Windows) sends the message WM_USER ?

It might be easier to use WSAEventSelect for your core by not needing an
hwnd, or even discard it completely in favor of Tcl's socket API and
call it directly from C.

chan = Tcl_OpenTcpClient(interp, 1024, "", "", 0, 1);
Tcl_SetChannelOption(interp, chan, "-translation", "line");
Tcl_CreateChannelHandler(chan, TCL_READABLE, readProc, NULL);

Going that route, you might consider leaving all the IO and eventloop
to the script level and limiting the C-Tcl interaction to atomic data