DragonFly kernel List (threaded) for 2003-11
[
Date Prev][
Date Next]
[
Thread Prev][
Thread Next]
[
Date Index][
Thread Index]
bind() failed: EADDRNOTAVAIL
i was just playing around with bulk.fefe.de/scalability benchmarks and
noticed one (maybe strange) thing.
(more to come, but i still have to parse the results..., too tired, i guess)
in bindbench:
bind(2) returns EADDRNOTAVAIL.
( bind(3980, sockaddr_in with sin_addr.s_addr = INADDR_ANY and sin_port = 0)
always fails with above error.
btw, i got the socket with socket(PF_INET,SOCK_STREAM,IPPROTO_TCP), all
previous binds(..3979) succeeded)
this may well be a sysctl or configuration related problem, although i doubt
it.
btw: after reboot, the socket is 3981, but nothing else is different.
attached is a (very) simple c file, which just sockets and binds, until an
error occures (on my system/setup on 3980-3rd run) or you kill it.
(this is basically a copy and inlining of fefes bindbench.c)
~ibotty
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <unistd.h>
#include <errno.h>
int main( int, const char **);
void byte_zero(void* out, unsigned long len);
int
main( int argc, const char ** argv)
{
int sock, r;
struct sockaddr_in si;
while (1)
{
sock = socket(PF_INET,SOCK_STREAM,IPPROTO_TCP);
byte_zero(&si,sizeof si );
si.sin_family = AF_INET;
si.sin_addr.s_addr = INADDR_ANY;
r = bind( sock, (struct sockaddr*) &si, sizeof si );
printf( "bind(%i,...) \n", sock );
if ( r == -1 )
{
printf( strerror(errno) );
break;
}
}
}
void byte_zero(void* out, unsigned long len) {
register char* s=out;
register const char* t=s+len;
for (;;) {
if (s==t) break; *s=0; ++s;
if (s==t) break; *s=0; ++s;
if (s==t) break; *s=0; ++s;
if (s==t) break; *s=0; ++s;
}
}
[
Date Prev][
Date Next]
[
Thread Prev][
Thread Next]
[
Date Index][
Thread Index]