Re: Problem with sockets

Oliver Elphick (olly@linda.lfix.co.uk)
Wed, 04 Dec 1996 08:50:11 +0000


In message <Pine.LNX.3.95.961204105018.5005B-100000@balance.canuck.gen.nz>, wri
tes:
>
>On Tue, 3 Dec 1996, Oliver Elphick wrote:
>
>> I came across this problem while trying to get INN to work.
>> [problem and source snipped]
>
>This has been around for as long as I can recall. From inspection, Linux
>won't let you bind to that address again because the socket is stuck in one
>of
>the terminal states (FIN1? 2? CLOSING? I forget...) for 60 (or is it 62?)
>after your app closes the socket. It makes debugging socket-based
>applications really annoying :)

I don't think that this is the same problem. The socket is newly opened; it
hasn't been opened before in the program. netstat shows nothing relevant:

linda:/usr2/home/olly$ netstat -awox
Active Internet connections (including servers)
Proto Recv-Q Send-Q Local Address Foreign Address (State) User
raw 0 0 *:1 *:* off (0.00/0) 0
Active UNIX domain sockets
Proto RefCnt Flags Type State Path

This is the strace output (from inndstart):

socket(PF_INET, SOCK_STREAM, IPPROTO_IP) = 4
setsockopt(4, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
bind(4, {sin_family=AF_INET, sin_port=htons(119), sin_addr=inet_addr("0.0.0.0")}, 16) = -1 EADDRINUSE (Address already in use)

There must be something wrong with my particular system; if this were a general
bug we would have heard about it.

Can anyone tell me how to debug a system call, please?