wrapSocket for socket_t? As wrapFile for FILE*

Beginner-8 via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Feb 14 23:05:57 PST 2016


On Sunday, 14 February 2016 at 08:19:16 UTC, Ali Çehreli wrote:
> On 02/14/2016 12:03 AM, Beginner-8 wrote:
>> Uh, wait! Forgot about that Socket calls .close() in its dtor
>
> Try duplicating the socket handle before handing it over to 
> Socket (not compiled nor tested):
>
> import core.sys.posix.unistd;
>
>     Socket(dup(myHandle))
>
> I think socket handles are duplicatable :p things. Only the 
> last close() would actually close the socket.
>
> Ali

This recipe works for me! Thanks!


More information about the Digitalmars-d-learn mailing list