Differences between version 6 and predecessor to the previous major change of EADDRINUSE.
Other diffs: Previous Revision, Previous Author, or view the Annotated Edit History
Newer page: | version 6 | Last edited on Monday, August 11, 2003 5:03:54 pm | by PerryLorier | Revert |
Older page: | version 5 | Last edited on Monday, August 11, 2003 4:44:56 pm | by SamJansen | Revert |
@@ -10,13 +10,13 @@
kill(1) the other program that is listening on that port and try again.
Usually you get this error when trying to start a daemon that is already running.
-This also occurs when a TCP socket is still timing out. If you stop a program that was listening then restart it again quickly, you may find you get this error. In this case either wait a few minutes (4 should do); or in the case that it is your own program; use the code below.
+This also occurs when a [
TCP]
socket is still timing out. If you stop a program that was listening then restart it again quickly, you may find you get this error. In this case either wait a few minutes (4 should do); or in the case that it is your own program; use the code below.
----
To code around this call
unsigned int opt = 1;
if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt))==-1) {
perror("setsockopt(fd,SOL_SOCKET, SO_REUSEADDR,1)");
!exit(1);
}