|
Boost : |
From: Christopher Kohlhoff (chris_at_[hidden])
Date: 2006-04-27 09:05:11
Hi Olaf,
--- Olaf van der Spek <olafvdspek_at_[hidden]> wrote:
> True, but sync operations are already quite easy to do easily and
> 'portably' via BSD sockets.
Hmmm, for very simple use cases maybe. But consider...
- Does the socket API need to be initialised (WSAStartup etc)?
- What is the best way to handle SIGPIPE if you write to a
disconnected socket?
- Thread-safety (or otherwise) of host resolution functions like
getaddrinfo.
- Whether IPv6 capable functions are available (they're not on
Windows 2000).
- Functions for scatter-gather operations (recvmsg/sendmsg and
WSASend/WSARecv) have quite different signatures.
- Whether socket option values are passed as void* or char*.
etc, etc.
In my experience, if you want your code to be portable it will
quickly acquire #ifdefs to cope with these differences. And
that's assuming you discover the differences at all - what's the
bet that there are people who port socket code to Mac OS X who
aren't aware that getaddrinfo isn't thread safe.
Cheers,
Chris
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk