🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.sun
Article #8657

tcp/ip: address already in use ?

#8657
From: Danielle Heinzer
Date: Thu, 27 Jun 1991 20:22
54 lines
2467 bytes
1.
From the Network Programming Manual (for sunos 4.1 on page 310-311):

"In certain cases the algorithm used by the system in selecting port numbers
is unsuitable for an application... the system would disallow binding the
same local address and port number to a socket if a previous data connection's
socket still existed... an option call must be performed prior to the address
binding:

int on = 1;
setsockopt(s, SOL_SOCKET, SO_REUSEADDR, &on, sizeof on);
bind(s, (struct sockaddr *) &sin, sizeof sin);

With the above call, local addresses may be bound that are already in use.
This does not violate the uniqueness requirement as the system still checks at
connect time to be sure any other sockets with the same local address and
port do not have the same foreign address and port. If the association exists,
the error EADDRINUSE is returned."

The setting of this option on a TCP/IP socket did not show any difference.
Can you tell me what this option is for?

2.
Following problem:
o A server task listens (X simultaneous sockets are allowed),
o nine sockets are already connected with client tasks,
o the server task is abborted by CTRL-C.

Another program tries to bind to the local address used by the preceding
server and gets error EADDRINUSE.

"netstat" shows no TCP utilisation of that port.

Any idea? Is it a sunos problem not releasing properly the sockets on abbort?

note: this does not happen if only one client was connected at the time the
abbort happens. this does happen only sporadically.

I did not report this problem to Sun Hotline because I am not able to provide
them with a 70 source lines test program...

Any help will be wellcome.

regards,
Danielle Heinzer
ESA Computer Department/Computer Services
European Space Operations Centre
Robert-Bosch-str. 5
6100 Darmstadt
West-Germany
Tel int : +49-6151-90-2540
Fax int : +49-6151-90-495
Bitnet  : dheinzer@esoc
Uucp    : unido!esoc.bitnet!dheinzer
Technical Details
Message-ID: <4026@brchh104.bnr.ca>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!cunews!bnrgate!brchh104!brchs1!bnr.ca!rice.edu!sun-spots-request

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!cunews!bnrgate!brchh104!brchs1!bnr.ca!rice.edu!sun-spots-request
From: DHEINZER%ESOC.BITNET@cunyvm.cuny.edu (Danielle Heinzer)
Newsgroups: comp.sys.sun
Subject: tcp/ip: address already in use ?
Keywords: No Digest Subjects during Flush
Message-ID: <4026@brchh104.bnr.ca>
Date: 27 Jun 91 20:22:00 GMT
Sender: news@brchh104.bnr.ca
Organization: Sunspots, Flush Mode
Lines: 55
Approved: sun-spots@rice.edu
X-Original-Date:    Thu, 13 Jun 91 14:53:54 CET