ftp problem: "bind: Address already in use"

ftp problem: "bind: Address already in use"

Post by to » Sun, 21 Feb 1993 04:40:56



While transferring files via FTP, I start getting the error message
"ftp: bind: Address already in use" whenever I want to do a directory
and transfer a file...  After this happens, ftp is useless (but I can still
ftp into the Linux box without problems) until I reboot.  
Is there a better fix for this?  By the way, it happens with .99pl4 and .99pl5.

 
 
 

1. Solution to "Address already in use" bind() problem?

Greetings netters -

I have a server application that does the common socket(), bind(),
accept() sequence, which usually works just fine.

However, in some situations after having restarted the program, the
bind() system call fails with the error "Address already in use". If I
wait about 2-3 minutes, the problem goes away.

Last time I investigated this, I was told that it is because the
socket on which the listener is running is not closed properly. Ok, so
I revised my code to make sure a close() is issued for the socket in
all cases. I still have the problem though.

The funny thing is, that if I CTRL-C kill the application, Idon't have
the problem, only if I shut down properly. (Perhaps CTRL-C forces the
kernel to clean up after the application, including any open sockets?)

I was also told, that the reason why the problem goes away after 2-3
minutes, is because this is a known problem under SysV, and there is a
built-in mechanism to "un-hang" hung ports to cope with this problem.

However, I'd really like to fix my app so it doesn't create this
problem following an orderly shutdown.

Any suggestions anyone?

TIA - Henrik

PS. I've tried the FAQ...

2. Memory max'ed problem

3. Help with "bind: Address already in use" errors

4. Questions & Answers

5. error in NAMED/BIND "Address already in use"

6. binary of new lynx for sparc solaris on a sunblade machine

7. bind error, "Address already in use"

8. FTP problem...

9. Getting error: "cpd bind address already in use"

10. "bind: Address already in use" error after 2.6 upgrade

11. error: could not bind to "IP" port 80 (Address already in use)

12. Identd "bind: Address already in use" messages in /var/log/messages

13. TCP/IP, bind() error, "address is already in use?"