wrapSocket for socket_t? As wrapFile for FILE*

Ali Çehreli via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Feb 14 00:19:16 PST 2016


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



More information about the Digitalmars-d-learn mailing list