* UNIX domain socket problem
@ 2006-11-07 1:47 Bin Chen
2006-11-07 10:23 ` Bernd Petrovitsch
0 siblings, 1 reply; 2+ messages in thread
From: Bin Chen @ 2006-11-07 1:47 UTC (permalink / raw)
To: linux-kernel
Sorry for cross post, it has been posted on
comp.os.linux.development.apps.
I wrote a domain socket sever, which is a STREAM type, let it listen a
sun_path, and in a while loop it accept new connections. I analyze it
using netstat.
Abstractly, the communication need two end. Even the listen socket is
only one, each time the accept returns, there should be two end
produced: one by connect() issued by client, one by accept() issued by
server. These two should have different inode number.
What is strange is that I sometimes find the RefCnt of some unix domain
socket have values 2,3,4,5,6,7 or even 258, if each connection in
stream should be in pair, why this problem occurs?
Thanks.
Binary
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: UNIX domain socket problem
2006-11-07 1:47 UNIX domain socket problem Bin Chen
@ 2006-11-07 10:23 ` Bernd Petrovitsch
0 siblings, 0 replies; 2+ messages in thread
From: Bernd Petrovitsch @ 2006-11-07 10:23 UTC (permalink / raw)
To: Bin Chen; +Cc: linux-kernel
On Tue, 2006-11-07 at 09:47 +0800, Bin Chen wrote:
> Sorry for cross post, it has been posted on
> comp.os.linux.development.apps.
>
> I wrote a domain socket sever, which is a STREAM type, let it listen a
> sun_path, and in a while loop it accept new connections. I analyze it
> using netstat.
>
> Abstractly, the communication need two end. Even the listen socket is
> only one, each time the accept returns, there should be two end
> produced: one by connect() issued by client, one by accept() issued by
> server. These two should have different inode number.
Why should they?
The filename (actually and more to the point: the i-node) in the
filesystem is just an "anchor" so that the clients can find the server
(if you have several servers on your system, they *must* have different
filenames to bind(2) to).
> What is strange is that I sometimes find the RefCnt of some unix domain
> socket have values 2,3,4,5,6,7 or even 258, if each connection in
> stream should be in pair, why this problem occurs?
Probably (because I didn't look at source code) because every connect(2)
and/or accept(2) sys-call increments it.
And BTW I assume that you meand the in memory ref count, not the one in
the inode on the disk (which is incremented with hardlinks).
Bernd
--
Firmix Software GmbH http://www.firmix.at/
mobil: +43 664 4416156 fax: +43 1 7890849-55
Embedded Linux Development and Services
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2006-11-07 10:23 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-11-07 1:47 UNIX domain socket problem Bin Chen
2006-11-07 10:23 ` Bernd Petrovitsch
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®