Xref: utzoo comp.protocols.tcp-ip.ibmpc:1910 comp.protocols.nfs:529 Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!gem.mps.ohio-state.edu!unix.cis.pitt.edu!sluggo From: sluggo@unix.cis.pitt.edu (Steve Kalinowski) Newsgroups: comp.protocols.tcp-ip.ibmpc,comp.protocols.nfs Subject: setsocketopt() trouble, SLOW close(sd), w/ PC-NFS Keywords: Sun PC-NFS, setsocketopt(), close(), SO_DONTLINGER Message-ID: <20596@unix.cis.pitt.edu> Date: 13 Nov 89 13:57:19 GMT Reply-To: sluggo@unix.cis.pittsburgh.edu (Steve Kalinowski) Distribution: usa Organization: Univ. of Pittsburgh, Comp & Info Sys Lines: 41 I am working on some code using Sun PC-NFS toolkit to talk to a Sun and a 'company-made' VMEbus computer. Everything is great except for making the close() command. I do a shutdown(sd,2) and then close, but the close() takes ~20secs on my PC-AT. This only happens on the socket open to the proprietary box (w/ a CMC ENP10 card w/ TCP roms) is closed. The socket to the Sun works fine. So I figured I needed to set the SO_DONTLINGER option for the socket, but... I am having a bit of trouble using PC-NFS's setsockopt call. I want to set the DONTLINGER option so that my close() calls will return immediately, but I keep getting EMFILE (errno==24) from the setopt. (The call DOES work for SO_REUSEADDR). A bit of the code follows: . . . if ((sock_desc = socket (AF_INET, conn_id->conn_type, 0)) < 0) printf("socket() failed w/ error %d\n", errno); if (setsockopt (sock_desc, SOL_SOCKET, SO_DONTLINGER, 0, 0) < 0) { close(sock_desc); printf("setsockopt() failed w/ error %d\n", errno); } . . . This code is used on my Sun 3/50 w/ success. I thought that there might be data stranded in the socket, so i added a recv, which hung. When the Sun closes its connection to our 'black box' the close is quick. Any advice will be most appreciated. steve' p.s. I know that EMFILE is not an expected result (according to the manual =8^) ). Also, I CAN get this to run w/o the DONTLINGER, so I don't believe the error indication.