Article View: dnet.general
Article #2099how to close a socket quickly?
From: tawab
Date: Thu, 27 Jul 1989 20:26
Date: Thu, 27 Jul 1989 20:26
46 lines
1814 bytes
1814 bytes
Hi,
can somebody out there tell me how to close a socket "quickly".
The problem I have is that after talking over a socket, I won't
need the socket any more and so I just close it, but it keeps
hanging around for about 2-3 min and blocks the queue for new
incoming messages. I know that a TCP-socket does something like
that. So I tried "shutdown(socket, 2)", but there is no difference.
the next I tried was ...
setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (char *)0, 0)
and
setsockopt(sock, SOL_SOCKET, SO_DONTLINGER, (char *)0, 0)
but it doesn't do what I want.
to test it I send messages in a loop to the server, (send is the client prog)
main()
{
int i;
for (i=0; i<=100; i++) {
system("send host text");
system("sleep 1"); /* If I enter this line, it will give the
best performance, whith or without
the setsockoptions and with or without
shutdown(socket,[0-2]) */
}
}
can anyone give me a solution?
I can't make the client sleep, because if 10 users use the client prog. at
the same time
Thanks for any answer.
Robin Tawab
NIXDORF COMPUTER AG
Dep DTSW 2-4
Berliner Str. 95
D-8000 Munic (West Germany)
Tel.: xxx-89/3601-3171
eunet: tawab.muc@nixpbe.UUCP
!USA: mcvax!unido!nixpbe!tawab.muc
USA: uunet!linus!nixbur!tawab.muc
Technical Details
Message-ID:
<10100001@net4>Path:
arc1-ca.pugleaf.net!gmdzi!unido!nixpbe!net4!tawabShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10dc06,5555a06e03928fc1,start X-Google-Attributes: gid10dc06,public X-Google-ArrivalTime: 1989-07-27 19:41:33 PST Path: arc1-ca.pugleaf.net!gmdzi!unido!nixpbe!net4!tawab From: tawab@net4.UUCP Newsgroups: dnet.general Subject: how to close a socket quickly? Message-ID: <10100001@net4> Date: 27 Jul 89 20:26:49 GMT Lines: 46 Nf-ID: #N:net4:10100001:000:1276 Nf-From: net4.UUCP!tawab Jul 26 10:45:00 1989 Posted: Thu Jul 27 21:26:49 1989