problem with closing sockets

Posted by Samantha on Stack Overflow See other posts from Stack Overflow or by Samantha
Published on 2010-03-17T09:44:32Z Indexed on 2010/03/17 9:51 UTC
Read the original article Hit count: 337

Filed under:
|
|

Hi,

I'm trying to write a client/server program with threads. I close the socket once the connexion is finished. The servers gets plenty of new connexions, and the socket number (file descriptor) increases very quickly: after 5 minutes running I was already at around file descriptor number 800!

Is this a normal thing? Do threads share file descriptors? When I do close(sockfd); is the number released immediatly or after a some time?

PS: I used to do with fork(), and I didn't have this issue. Thanks

© Stack Overflow or respective owner

Related posts about c

    Related posts about socket