(Simple) problem with sockets

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is more of a Linux socket API question... I have a server thread that
accepts (accept sys call) socket connections and then services a client
request and closes the socket connection using:

shutdown(fd, SHUT_RDWR);
close(fd);

My problem is this... after a while I see that the file descriptor returned
by the accept system call slowly starts increasing.  It starts increasing in
the integer file descriptor number returned by the system call (the FD that
we use to do the read and write system calls).

I have two problems:
1) I'm using the file descriptor as an index into a fixed size array
2) I'm scared of eventually running out of file descriptors.

Further more, when I do a "file /proc/PID/fd/XXX" I get a "/proc/PID/fd/XXX:
broken symbolic link to socket:[BLAH]"

Why is this file descriptor still lingering around and how do I get rid of
it when I do a close on the socket?

Thanks
Lee


______________________________________________
FREE Personalized Email at Mail.com
Sign up at http://www.mail.com/?sr=signup
-
: send the line "unsubscribe linux-net" in
the body of a message to majordomo@vger.kernel.org


[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux 802.1Q VLAN]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Git]     [Bugtraq]     [Yosemite News and Information]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux PCI]     [Linux Admin]     [Samba]

  Powered by Linux