stat() on socket

Hi all,

from helpviewer:

//
int stat( const char * path, struct stat * buf );

The stat() and stat64() functions obtain information about the file or
directory referenced in path. This information is placed in the structure
located at the address indicated by buf.
/
/

Q: field st_mode of a stat structure can be S_IFSOCK. What I need fill to
path to get this stat ?

for example I have socket in LISTEN state on port 6000
Can I stat this socket ?

Thanks Jakub Safarik

There’s no path associated with an AF_INET
socket. What information were you looking
for?

-seanb

Safarik Jakub <jsafarik@retia.cz> wrote:
: Hi all,

: from helpviewer:

: //
: int stat( const char * path, struct stat * buf );
: …
: The stat() and stat64() functions obtain information about the file or
: directory referenced in path. This information is placed in the structure
: located at the address indicated by buf.
: /
/

: Q: field st_mode of a stat structure can be S_IFSOCK. What I need fill to
: path to get this stat ?

: for example I have socket in LISTEN state on port 6000
: Can I stat this socket ?

: Thanks Jakub Safarik

Safarik Jakub <jsafarik@retia.cz> wrote:

Hi all,

from helpviewer:

//
int stat( const char * path, struct stat * buf );

The stat() and stat64() functions obtain information about the file or
directory referenced in path. This information is placed in the structure
located at the address indicated by buf.
/
/

Q: field st_mode of a stat structure can be S_IFSOCK. What I need fill to
path to get this stat ?

for example I have socket in LISTEN state on port 6000
Can I stat this socket ?

You want to fstat(sockfd, …)

-xtang

Thanks Jakub Safarik

I’m looking for status of tcp connections. I want get state of each
connections and if any data was transmitted between my processes.
How can I do it ?


Sean Boudreau <seanb@qnx.com> pí¹e v diskusním
pøíspìvku:9tgc3b$g68$1@nntp.qnx.com

There’s no path associated with an AF_INET
socket. What information were you looking
for?

-seanb

Safarik Jakub <> jsafarik@retia.cz> > wrote:
: Hi all,

: from helpviewer:

: //
: int stat( const char * path, struct stat * buf );
: …
: The stat() and stat64() functions obtain information about the file or
: directory referenced in path. This information is placed in the
structure
: located at the address indicated by buf.
: /
/

: Q: field st_mode of a stat structure can be S_IFSOCK. What I need fill
to
: path to get this stat ?

: for example I have socket in LISTEN state on port 6000
: Can I stat this socket ?

: Thanks Jakub Safarik
\

Try ‘netstat’ with no options.


Bill Caroselli – 1(530) 510-7292
Q-TPS Consulting
QTPS@EarthLink.net


“Safarik Jakub” <jsafarik@retia.cz> wrote in message
news:9tgg4a$jtq$1@inn.qnx.com

I’m looking for status of tcp connections. I want get state of each
connections and if any data was transmitted between my processes.
How can I do it ?


Sean Boudreau <> seanb@qnx.com> > pí¹e v diskusním
pøíspìvku:9tgc3b$g68$> 1@nntp.qnx.com> …

There’s no path associated with an AF_INET
socket. What information were you looking
for?

-seanb

Safarik Jakub <> jsafarik@retia.cz> > wrote:
: Hi all,

: from helpviewer:

: //
: int stat( const char * path, struct stat * buf );
: …
: The stat() and stat64() functions obtain information about the file or
: directory referenced in path. This information is placed in the
structure
: located at the address indicated by buf.
: /
/

: Q: field st_mode of a stat structure can be S_IFSOCK. What I need
fill
to
: path to get this stat ?

: for example I have socket in LISTEN state on port 6000
: Can I stat this socket ?

: Thanks Jakub Safarik


\

Sure, I can obtain info abou connections by netstat, but I want get this in
my code.



Bill Caroselli <qtps@earthlink.net> pí¹e v diskusním
pøíspìvku:9tgjlf$nok$1@inn.qnx.com

Try ‘netstat’ with no options.


Bill Caroselli – 1(530) 510-7292
Q-TPS Consulting
QTPS@EarthLink.net


“Safarik Jakub” <> jsafarik@retia.cz> > wrote in message
news:9tgg4a$jtq$> 1@inn.qnx.com> …
I’m looking for status of tcp connections. I want get state of each
connections and if any data was transmitted between my processes.
How can I do it ?


Sean Boudreau <> seanb@qnx.com> > pí¹e v diskusním
pøíspìvku:9tgc3b$g68$> 1@nntp.qnx.com> …

There’s no path associated with an AF_INET
socket. What information were you looking
for?

-seanb

Safarik Jakub <> jsafarik@retia.cz> > wrote:
: Hi all,

: from helpviewer:

: //
: int stat( const char * path, struct stat * buf );
: …
: The stat() and stat64() functions obtain information about the file
or
: directory referenced in path. This information is placed in the
structure
: located at the address indicated by buf.
: /
/

: Q: field st_mode of a stat structure can be S_IFSOCK. What I need
fill
to
: path to get this stat ?

: for example I have socket in LISTEN state on port 6000
: Can I stat this socket ?

: Thanks Jakub Safarik




\

Hi,
Can I use fstat on filedescriptor opened by another proccess ?
How can I do it if I know pid of this proccess ?

Xiaodan Tang <xtang@qnx.com> pí¹e v diskusním
pøíspìvku:9tggel$iov$2@nntp.qnx.com

Safarik Jakub <> jsafarik@retia.cz> > wrote:
Hi all,

from helpviewer:

//
int stat( const char * path, struct stat * buf );

The stat() and stat64() functions obtain information about the file or
directory referenced in path. This information is placed in the
structure
located at the address indicated by buf.
/
/

Q: field st_mode of a stat structure can be S_IFSOCK. What I need fill
to
path to get this stat ?

for example I have socket in LISTEN state on port 6000
Can I stat this socket ?

You want to fstat(sockfd, …)

-xtang

Thanks Jakub Safarik
\

Can we back up and ask why you want this info? netstat
won’t tell you how much data has been transfered per
socket, just how much is currently in send, rcv buffer.

-seanb

Safarik Jakub <jsafarik@retia.cz> wrote:
: Sure, I can obtain info abou connections by netstat, but I want get this in
: my code.



: Bill Caroselli <qtps@earthlink.net> pí¹e v diskusním
: pøíspìvku:9tgjlf$nok$1@inn.qnx.com
:> Try ‘netstat’ with no options.
:>
:> –
:> Bill Caroselli – 1(530) 510-7292
:> Q-TPS Consulting
:> QTPS@EarthLink.net
:>
:>
:> “Safarik Jakub” <jsafarik@retia.cz> wrote in message
:> news:9tgg4a$jtq$1@inn.qnx.com
:> > I’m looking for status of tcp connections. I want get state of each
:> > connections and if any data was transmitted between my processes.
:> > How can I do it ?
:> >
:> >
:> > Sean Boudreau <seanb@qnx.com> pí¹e v diskusním
:> > pøíspìvku:9tgc3b$g68$1@nntp.qnx.com
:> > >
:> > > There’s no path associated with an AF_INET
:> > > socket. What information were you looking
:> > > for?
:> > >
:> > > -seanb
:> > >
:> > > Safarik Jakub <jsafarik@retia.cz> wrote:
:> > > : Hi all,
:> > >
:> > > : from helpviewer:
:> > >
:> > > : //
:> > > : int stat( const char * path, struct stat * buf );
:> > > : …
:> > > : The stat() and stat64() functions obtain information about the file
: or
:> > > : directory referenced in path. This information is placed in the
:> > structure
:> > > : located at the address indicated by buf.
:> > > : /
/
:> > >
:> > > : Q: field st_mode of a stat structure can be S_IFSOCK. What I need
:> fill
:> > to
:> > > : path to get this stat ?
:> > >
:> > > : for example I have socket in LISTEN state on port 6000
:> > > : Can I stat this socket ?
:> > >
:> > > : Thanks Jakub Safarik
:> > >
:> > >
:> > >
:> > >
:> >
:> >
:>
:>

I want this info for diagnostic state of tcp connections. Can I fstat()
filedescriptor opened by another proccess ?
Can fstat tell me if any data was written/readen on the socket fd ?

thanks

Sean Boudreau <seanb@qnx.com> píse v diskusním
pøíspìvku:9tj18q$767$1@nntp.qnx.com

Can we back up and ask why you want this info? netstat
won’t tell you how much data has been transfered per
socket, just how much is currently in send, rcv buffer.

-seanb

Safarik Jakub <> jsafarik@retia.cz> > wrote:
: Sure, I can obtain info abou connections by netstat, but I want get this
in
: my code.



: Bill Caroselli <> qtps@earthlink.net> > pí¹e v diskusním
: pøíspìvku:9tgjlf$nok$> 1@inn.qnx.com> …
:> Try ‘netstat’ with no options.
:
:> –
:> Bill Caroselli – 1(530) 510-7292
:> Q-TPS Consulting
:> > QTPS@EarthLink.net
:
:
:> “Safarik Jakub” <> jsafarik@retia.cz> > wrote in message
:> news:9tgg4a$jtq$> 1@inn.qnx.com> …
:> > I’m looking for status of tcp connections. I want get state of each
:> > connections and if any data was transmitted between my processes.
:> > How can I do it ?
:
:
:> > Sean Boudreau <> seanb@qnx.com> > pí¹e v diskusním
:> > pøíspìvku:9tgc3b$g68$> 1@nntp.qnx.com> …
:
:> > > There’s no path associated with an AF_INET
:> > > socket. What information were you looking
:> > > for?
:
:> > > -seanb
:
:> > > Safarik Jakub <> jsafarik@retia.cz> > wrote:
:> > > : Hi all,
:
:> > > : from helpviewer:
:
:> > > : //
:> > > : int stat( const char * path, struct stat * buf );
:> > > : …
:> > > : The stat() and stat64() functions obtain information about the
file
: or
:> > > : directory referenced in path. This information is placed in the
:> > structure
:> > > : located at the address indicated by buf.
:> > > : /
/
:
:> > > : Q: field st_mode of a stat structure can be S_IFSOCK. What I
need
:> fill
:> > to
:> > > : path to get this stat ?
:
:> > > : for example I have socket in LISTEN state on port 6000
:> > > : Can I stat this socket ?
:
:> > > : Thanks Jakub Safarik
:
:
:
:
:
:
:
:

fstat() isn’t supported on sockets.

-seanb

“Safaøík Jakub” <jsafarik@retia.cz> wrote:
: I want this info for diagnostic state of tcp connections. Can I fstat()
: filedescriptor opened by another proccess ?
: Can fstat tell me if any data was written/readen on the socket fd ?

: thanks

: Sean Boudreau <seanb@qnx.com> píse v diskusním
: pøíspìvku:9tj18q$767$1@nntp.qnx.com
:>
:> Can we back up and ask why you want this info? netstat
:> won’t tell you how much data has been transfered per
:> socket, just how much is currently in send, rcv buffer.
:>
:> -seanb
:>
:> Safarik Jakub <jsafarik@retia.cz> wrote:
:> : Sure, I can obtain info abou connections by netstat, but I want get this
: in
:> : my code.
:>
:>
:>
:> : Bill Caroselli <qtps@earthlink.net> pí¹e v diskusním
:> : pøíspìvku:9tgjlf$nok$1@inn.qnx.com
:> :> Try ‘netstat’ with no options.
:> :>
:> :> –
:> :> Bill Caroselli – 1(530) 510-7292
:> :> Q-TPS Consulting
:> :> QTPS@EarthLink.net
:> :>
:> :>
:> :> “Safarik Jakub” <jsafarik@retia.cz> wrote in message
:> :> news:9tgg4a$jtq$1@inn.qnx.com
:> :> > I’m looking for status of tcp connections. I want get state of each
:> :> > connections and if any data was transmitted between my processes.
:> :> > How can I do it ?
:> :> >
:> :> >
:> :> > Sean Boudreau <seanb@qnx.com> pí¹e v diskusním
:> :> > pøíspìvku:9tgc3b$g68$1@nntp.qnx.com
:> :> > >
:> :> > > There’s no path associated with an AF_INET
:> :> > > socket. What information were you looking
:> :> > > for?
:> :> > >
:> :> > > -seanb
:> :> > >
:> :> > > Safarik Jakub <jsafarik@retia.cz> wrote:
:> :> > > : Hi all,
:> :> > >
:> :> > > : from helpviewer:
:> :> > >
:> :> > > : //
:> :> > > : int stat( const char * path, struct stat * buf );
:> :> > > : …
:> :> > > : The stat() and stat64() functions obtain information about the
: file
:> : or
:> :> > > : directory referenced in path. This information is placed in the
:> :> > structure
:> :> > > : located at the address indicated by buf.
:> :> > > : /
/
:> :> > >
:> :> > > : Q: field st_mode of a stat structure can be S_IFSOCK. What I
: need
:> :> fill
:> :> > to
:> :> > > : path to get this stat ?
:> :> > >
:> :> > > : for example I have socket in LISTEN state on port 6000
:> :> > > : Can I stat this socket ?
:> :> > >
:> :> > > : Thanks Jakub Safarik
:> :> > >
:> :> > >
:> :> > >
:> :> > >
:> :> >
:> :> >
:> :>
:> :>
:>
:>