TIL: writing to a socket and dying

2025-04-24 Thread Andy Valencia via Digitalmars-d-learn
This has been touched upon way back in forum history, but I thought it was worth a fresh mention. When writing to a socket--especially as a server--you can receive SIGPIPE. Phobos appears to try and inhibit this on some BSD systems, but on Linux if the recipient has closed the socket and you

Re: TIL: writing to a socket and dying

2025-04-24 Thread Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
On 25/04/2025 2:04 AM, Andy Valencia wrote: This has been touched upon way back in forum history, but I thought it was worth a fresh mention.  When writing to a socket--especially as a server--you can receive SIGPIPE.  Phobos appears to try and inhibit this on some BSD systems, but on Linux if

Re: extern(C++): override nonvirtual member function

2025-04-24 Thread evilrat via Digitalmars-d-learn
On Thursday, 24 April 2025 at 19:41:48 UTC, sfp wrote: I'm trying to wrap some C++ classes, and one issue I've run into is having an extern(C++) class inheriting from another, with the child doing a "nonvirtual override" of a nonvirtual member function in the base class... E.g., in C++: ``` st

Re: TIL: writing to a socket and dying

2025-04-24 Thread kdevel via Digitalmars-d-learn
On Thursday, 24 April 2025 at 14:04:03 UTC, Andy Valencia wrote: [...] Phobos appears to try and inhibit this on some BSD systems, How does it do that? but on Linux if the recipient has closed the socket and [the OPs process running his progam] write[s]--SIGPIPE. "the whole point of the sig

extern(C++): override nonvirtual member function

2025-04-24 Thread sfp via Digitalmars-d-learn
I'm trying to wrap some C++ classes, and one issue I've run into is having an extern(C++) class inheriting from another, with the child doing a "nonvirtual override" of a nonvirtual member function in the base class... E.g., in C++: ``` struct A { void f() { ... } ... // some other virtua

Re: TIL: writing to a socket and dying

2025-04-24 Thread Andy Valencia via Digitalmars-d-learn
On Thursday, 24 April 2025 at 19:36:03 UTC, kdevel wrote: [...] I added a SIG_IGN of SIGPIPE and that made the problem stop. You know that it will now throw? [0] Yes; my server was written to handle an exception, and it also is prepared for the send() to return failure. Adding a third vecto