Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 2 Aug 1999 16:39:25 -0700
From:      Xiaodong Shen <xshen@sb.net>
To:        freebsd-net@FreeBSD.org
Subject:   unix domain socket
Message-ID:  <99080217524106.55844@wiggum.com>

next in thread | raw e-mail | index | archive | help
Hi there,

I run a very simple client-server program using Unix Domain Socket on FreeBSD
and Linux, the server part looks like this:

for(;;){
  unlink foo; //foo is something like a pipe on local file system
  open_socket; //AF_UNIX and SOCK_STREAM, get a socket say fd_listen
  bind; // with foo
  listen; // say on listening socket: fd_listen, len_queue = 5
  
  select; // select on fd_listen
  accept; //get a new socket say fd_conn
  do_something; // on the socket fd_conn

  close(fd_conn);
  close(fd_listen);
}

On the client side I fork several child processes to simulate concurrent
connections to the server. 

Results:
Linux: all the connections are caught and handled by server.
FreeBSD: some of the connections are missed during select() on server.

Question:
For FreeBSD when you close the listening socket, those connnections left in the
listening queue that have not accepted by server will be cleared immediately
in stead of hanging there like the case for Linux, is that right? Is there
any BSD expert could give an explanation of what really happen in BSD's kernel?
Should this be considered a bug of FreeBSD?

Thanks a lot,

Xiaodong Shen


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-net" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?99080217524106.55844>