| Summary: | SDLNet_TCP_Send and SIGPIPE | ||
|---|---|---|---|
| Product: | SDL_net | Reporter: | Sam Lantinga <slouken> |
| Component: | misc | Assignee: | Sam Lantinga <slouken> |
| Status: | RESOLVED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P2 | ||
| Version: | unspecified | ||
| Hardware: | All | ||
| OS: | Linux | ||
|
Description
Sam Lantinga
2006-01-31 09:25:25 UTC
SDL_net now sets a SIGPIPE handler, for maximum portability. The semantic has always been that if SDLNet_TCP_Send() returns less data then you requested sending, then the socket has been closed, or another error has occurred. (discussion from http://forum.sun.com/jive/thread.jspa?threadID=84670) if you can handle EPIPE as a result from your send()/recv(), the best thing to do is a process-wide SIG_IGN for SIGPIPE. for portable code, some of the BSD-derivatives have a socket option SO_NOSIGPIPE which lets you disable this on a per-socket basis, which is often nicer. Linux has an option to send(2) MSG_NOSIGNAL which disables SIGPIPE on a per-send() basis (not as nice as the socket option, IMO). but the only thing to work portably is to SIG_IGN it. |