wrapSocket for socket_t? As wrapFile for FILE*

Beginner-8 via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Feb 13 22:38:08 PST 2016


On Sunday, 14 February 2016 at 06:10:04 UTC, Beginner-8 wrote:
> On Sunday, 14 February 2016 at 06:01:11 UTC, tcak wrote:
>
>> Unless you explicitly call "close" method of Socket object, 
>> its descriptor will
>> stay allocated for your process/program.
>
> Hmm, I am seen what Socket dtor contains close() too:
>
> https://github.com/D-Programming-Language/phobos/blob/master/std/socket.d#L2659

I would say that the socket should not be closed by my code.

For files this way is wrapFile: "The resulting File never takes 
the initiative in closing the file."
http://dlang.org/library/std/stdio/file.wrap_file.html

It seems that something like this is necessary also for Socket.



More information about the Digitalmars-d-learn mailing list