|
Home > Archive > Unix Programming > April 2004 > why there is still bind error:address already in use
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
why there is still bind error:address already in use
|
|
| zhengda 2004-04-21, 11:35 am |
| i write a program with socket.
and i have used the function setsockopt(listenfd , SOL_SOCKET , SO_REUSEADDR
, &opt , sizeof(opt)),
but there is still an error "bind error:address already in use"
why?
| |
| Barry Margolin 2004-04-21, 11:35 am |
| In article <c661sj$3uj$2@mail.cn99.com>,
"zhengda" <zhengda1936@sina.com> wrote:
> i write a program with socket.
> and i have used the function setsockopt(listenfd , SOL_SOCKET , SO_REUSEADDR
> , &opt , sizeof(opt)),
> but there is still an error "bind error:address already in use"
> why?
Show us some more code.
--
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
| |
| David Schwartz 2004-04-21, 12:34 pm |
|
"zhengda" <zhengda1936@sina.com> wrote in message
news:c661sj$3uj$2@mail.cn99.com...
>i write a program with socket.
> and i have used the function setsockopt(listenfd , SOL_SOCKET ,
> SO_REUSEADDR
> , &opt , sizeof(opt)),
> but there is still an error "bind error:address already in use"
> why?
Because the address is in use?
DS
| |
| joe@invalid.address 2004-04-21, 1:36 pm |
| "zhengda" <zhengda1936@sina.com> writes:
> i write a program with socket. and i have used the function
> setsockopt(listenfd , SOL_SOCKET , SO_REUSEADDR , &opt ,
> sizeof(opt)), but there is still an error "bind error:address
> already in use" why?
Use netstat to see if the port is already bound by something else.
Joe
--
If people don't want to come out to the ballpark, nobody's going
to stop them.
- Yogi Berra
| |
| John Galt 2004-04-23, 6:34 pm |
| "zhengda" <zhengda1936@sina.com> wrote in message news:<c661sj$3uj$2@mail.cn99.com>...
> i write a program with socket.
> and i have used the function setsockopt(listenfd , SOL_SOCKET , SO_REUSEADDR
> , &opt , sizeof(opt)),
have you set the var 'opt' to the correct (positive) value?
Calling setsockopt() with opt = 0 is not effective.
-John
|
|
|
|
|