Glenn Strauss wrote:
[...]
(On other platforms, like Windows, I don't know what apr_os_sock_t is;
check the headers files. :)

I'd rather not expose OS specific bits if they won't work with all perl modules. APR provides the API that should (hopefully) work on all platforms, so why not use that?


I'm not a Windows programmer, but in the case of sockets, it looks like
it might be an int (file descriptor) on Windows, too.  We're talking
Berkeley sockets on both platforms, right?  Whatever socket() returns.


I was wrong.  apr_os_sock_t is a (SOCKET) on Win32, not an (int).


why then APR went through the pain of abstracting this interface?


Turns out to be the obvious answer: because Windows does it differently
from everyone else.  Whether that is better or worse depends on the
situation, but the pain in writing cross-platform code still riles me,
not to mention how many 10's of clicks (hundreds?) it took me to navigate
the MSDN morass of documentation to find the following:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemNetSocketsSocketPropertiesTopic.asp
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemnetsocketssocketclasshandletopic.asp
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemintptrclasstopic.asp

The Socket.Handle property is what I think is needed so that
APR::OS::sock_get() can be made to work on Windows, too.
mpxs_APR__OS_sock_get() will need to special-case Windows platforms
and pull the Handle property.  I hope that works.  Any Windows
programmers out there?

and I suppose IntPtr is an integer pointer?
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemintptrclasstopic.asp
but it can't be really casted with (int) as it can be longer than sizeof(int). and if it was the case, why didn't apr provid such a call?


So do you think it's easier to just get this sock_get thing crossplatform and then just use perl modules to manipulate the socket object? Or is it better to expose apr_poll(set)?_.* interface? I prefer the later, as we won't need to deal with crossplatform issues, leaving those to the letter P in APR.

--
__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

--
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html



Reply via email to