Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Oli Howson
March 9, 2005, 1:19 am
rate this thread
I'm looking through a complex script at the moment.
If the OS is FreeBSD, the script defines EINPROGRESS to error 36 (Operation
now in progress), EALREADY to error 37 (Operation already in progress), and
EISCONN to error 56 (Socket is already connected). If it's Linux, then sets
them to 115, 114 and 106 respectively. I want to try and add Windows
compatability to this code. I've printed a list of all Windows socket error
codes from 0 to 15000, but can't find the similar errors, anyone got any
- Senator Jay Billington Bulwort
March 9, 2005, 6:40 pm
Re: Socket errors
Windows defines a WSAEINPROGRESS constant in API, which is the closest
equivalent to FreeBSD's EINPROGRESS, though I don't know whether or not
it would be available to PHP. In fact I rather doubt it.
Sockets compatibility between BSD (or BSD-like stacks, including pretty
much any Unix) and Windows is notoriously pesky regardless of language,
because Windows does not implement all of the BSD socket capabilities,
e.g. good luck trying SO_RCVTIMEO or SO_SNDTIMEO on Windows. Options that
FreeBSD will happily support for setsockopt() in C don't work on Windows,
and I imagine the same is true for socket_set_option() in PHP.
My suggestion would be to attempt to simulate test conditions where you
know what the error will be, and see what socket_last_error() returns in
each case. If anyone can give some better input, I'd be just as
interested in it as you are! While I don't currently do PHP on Windows, I
do a fair bit of sockets in PHP, so the more platforms the merrier.
Bulworth : PHP/MySQL/Unix | Email : str_rot13('email@example.com');
<http://www.phplabs.com/ | PHP scripts, webmaster resources