Re: BSD #define (MSG_NOSIGNAL) vs. Apple #define (MSG_HAVEMORE)
Re: BSD #define (MSG_NOSIGNAL) vs. Apple #define (MSG_HAVEMORE)
- Subject: Re: BSD #define (MSG_NOSIGNAL) vs. Apple #define (MSG_HAVEMORE)
- From: Quinn <email@hidden>
- Date: Thu, 1 Jan 1970 08:32:20 -0800
At 23:23 +0100 19/12/02, Jens Bauer wrote:
MSG_NOSIGNAL clashes with Apple's MSG_HAVEMORE
(notice: MSG_DONTWAIT is 0x80 in my socket.h, but it seems it's 0x40
in the Linux socket.h)
-I can't make up my own MSG_NOSIGNAL, so what should I do to the
following line...
return(-1 != ::send(m_Sock, s.c_str(), s.size(), MSG_NOSIGNAL));
I'm not sure about the specifics of send (I'm on an aeroplane so I
don't have access to the usualh resources), but the traditional UNIX
approach to not getting EPIPE is to mask it.
----------------------------------------------------------------------------
extern int MoreUNIXIgnoreSIGPIPE(void);
// Sets the handler for SIGPIPE to SIG_IGN. If you don't call
// this, writing to a broken pipe will cause SIGPIPE (rather
// than having "write" return EPIPE), which is hardly ever
// what you want.
----------------------------------------------------------------------------
extern int MoreUNIXIgnoreSIGPIPE(void)
// See comment in header.
{
int err;
struct sigaction signalState;
err = sigaction(SIGPIPE, NULL, &signalState);
err = MoreUNIXErrno(err);
if (err == 0) {
signalState.sa_handler = SIG_IGN;
err = sigaction(SIGPIPE, &signalState, NULL);
err = MoreUNIXErrno(err);
}
return err;
}
----------------------------------------------------------------------------
S+E
--
Quinn "The Eskimo!" <
http://www.apple.com/developer/>
Apple Developer Technical Support * Networking, Communications, Hardware
_______________________________________________
macnetworkprog mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/macnetworkprog
Do not post admin requests to the list. They will be ignored.