Paul Moore <[EMAIL PROTECTED]> writes:
>From: Nick Ing-Simmons [mailto:[EMAIL PROTECTED]]
>>
>> long
>> Lang_OSHandle(fd)
>> int fd;
>> {
>> #ifdef WIN32
>>  return win32_get_osfhandle(fd);
>> #else
>>  return fd;
>> #endif
>> }
>
>On a similar note, I can sort out the socket issue (socket handles not being
>waitable objects), if I can get from a Perl SV to a Winsock SOCKET value.

I don't remember. Perl opens sockets in a manner which makes them 
usable as Handles. This makes them work with "WinSock" style select().
IIRC it also prevents you waiting on them (or rather they are always
ready). Tcl works round this by switching modes of sockets on-the-fly.

>Can I do so? In particular, given a SV*, what I want to be able to do (in
>the io watcher code) is:
>
>   1. If it's not a filehandle, complain.
>   2. If it's not a socket, get the fd
>      and from there get the HANDLE, as above.
>   3. If it is a socket, get the SOCKET. With
>      the SOCKET, I can do WSAEventSelect to
>      get an event handle which is waitable.

It is step 3 that is the problem the HANDLE is the SOCKET in the mode
perl is using again IIRC in such a mode WSAEventSelect does not help.
But if you figure it out I can copy it to make Win32/Tk work right 
even before I use Event.pm ;-)

>
>Just looking in the docs, it's interesting to note that perlapio.pod
>explains all about PerlIO, but nowhere explains how to get a PerlIO* from a
>SV*. I can crib the code from c/unix_io.c for this, though.

Maybe because it is in perlguts.pod ...

Be careful to get right PerlIO from the GV - it has two for sockets.


>
>Paul.
-- 
Nick Ing-Simmons <[EMAIL PROTECTED]>
Via, but not speaking for: Texas Instruments Ltd.

Reply via email to