Re: [PHP4BETA] PF_INET
| From: | Jonathan Perret | Date: | Mon, 22 Nov 1999 21:27:05 +0000 |
| Subject: | Re: [PHP4BETA] PF_INET | ||
| Groups: | php.version4 | ||
| Request: | Send a blank email to php-version4+get-6696@lists.php.net to get a copy of this message | ||
Philippe Verdy <verdy_p@wanadoo.fr> wrote :
[snipped explanation of packet families vs. address families]
>But that's right, any known implementation of the socket layer #define
>address families like protocol families.
>To answer your question, I think that BeOS is not conforming to the socket
>standard, because it lacks the abstraction of "address families". If you
>don't have AF_XXX symbols in your include files, but if you've got
>compatible system calls for sockets, you should better add custom
>definitions which add missing definitions within your socket include files,
>so that you will use AF_XXX wherever address nodes are designated, but not
>PF_XXX which is used to select transport protocols. Making so, your source
>will compile correctly on future socket implementations, and on other
>systems. At least you should look at examples in "winsock.h" (for 16-bit
>Windows 3.x) to know which AF_XXX constitutes the basic socket services.
>The best thing then is to use code like:
>#include <socket.h>... // any system includes for sockets...
>#ifndef AF_INET
>#define AF_INET PF_INET
>#endif
>within the C source that uses sockets, so that you won't modify the body of
>C functions that SHOULD always use AF_XXX (not PF_XXX) where node addresses
>are specified.
>There is no guarantee that AF_INET and PF_INET will be kept the same in the
>future, when IPv6 will become THE standard.
There has been some misunderstanding :
1) What's lacking on BeOS is PF_xxx, not AF_xxx. Not much existing code
would compile if AF_xxx did not exist !
2) The two lonely instances of PF_INET in the PHP source are IMHO a case
of being uselessly zealous because the rest of the code uses AF_INET (for
example, fsock.c) so at best it is an inconsistency.
Cheers,
--Jonathan