bind(): Can't assign requested address

Sean Chittenden sean at chittenden.org
Mon Nov 22 18:28:30 PST 2004


On Nov 22, 2004, at 17:48, Anatoly Vorobey wrote:

> On Mon, Nov 22, 2004 at 05:23:03PM -0800, Dave Roe wrote:
>> Okay, this is just the man page, so I figured I could still proceed,
>> but I am unable to start memcached using "sudo 
>> /usr/local/bin/memcached
>> -l 127.0.0.1 -p 11211 -m 64 -d". It fails with:
>>
>> bind(): Can't assign requested address
>> failed to listen

Hrm.. I'm using memcached on my laptop w/o any problems.  The only 
problem I have is terrible kqueue(2) performance on OS-X, though I'm 
starting to get the impression that Apple crippled this system call on 
their non-server OS versions.  But, I don't need to tweak anything to 
get it running.  What OS version?

> Please try this patch and tell me if it helps. I don't have an OS X
> machine to test it with.
>
> --- cvs/wcmtools/memcached/memcached.c  2004-09-13 16:25:42.000000000
> -0700
> +++ src/memcached/memcached.c   2004-11-22 17:45:57.000000000 -0800
> @@ -1143,6 +1143,7 @@
>      setsockopt(sfd, IPPROTO_TCP, TCP_NODELAY, &flags, sizeof(flags));
>  #endif
>
> +    memset(&addr, 0, sizeof(addr));

Use bzero(3) instead of memest(,0,).  bzero(3) is always going to be 
faster since most OSes provide asm optimized verions of said call.

bzero(&addr, sizeof(addr));

>      addr.sin_family = AF_INET;
>      addr.sin_port = htons(port);
>      addr.sin_addr = settings.interface;

-sc

-- 
Sean Chittenden



More information about the memcached mailing list