socket - Unix

This is a discussion on socket - Unix ; hello, is it possible to determine for opened socket when last time it was used, I need to do it by some system function I can't record the time of its use....

+ Reply to Thread
Results 1 to 3 of 3

Thread: socket

  1. socket

    hello,

    is it possible to determine for opened socket when last time it was
    used,
    I need to do it by some system function I can't record the time of
    its
    use.


  2. Re: socket

    Sonda wrote:
    > is it possible to determine for opened socket when last time it was
    > used, I need to do it by some system function I can't record the time of
    > its use.


    A 'socket' is just an abstract handle that represents some kind of a
    connection or communication channel. When the 'socket' is created, the
    connection is created, too, and it is therefore not like a file that is
    opened. In effect, that means that you simply can't detect when a socket is
    opened.

    Now, what is it that you want to achieve? If it is just that you want to
    e.g. trace when a program makes a TCP connection to a certain host, you
    could e.g. write a wrapper library that intercepts calls to socket() (like
    some memory debuggers do for malloc/free) or use a TCP sniffer tool/library
    to detect those connections nonintrusively.

    Still, the question remains: what do you want?

    Uli


  3. Re: socket

    "Ulrich Eckhardt" schrieb im Newsbeitrag
    news:5clp90F30k9b1U1@mid.uni-berlin.de...
    > Sonda wrote:
    >> is it possible to determine for opened socket when last time it was
    >> used, I need to do it by some system function I can't record the time of
    >> its use.

    >
    > A 'socket' is just an abstract handle that represents some kind of a
    > connection or communication channel. When the 'socket' is created, the
    > connection is created, too, and it is therefore not like a file that is
    > opened. In effect, that means that you simply can't detect when a socket
    > is
    > opened.

    Unless he's talking about AF_UNIX sockets, at which he could be using stat()
    and/or fstat().

    Bye, Jojo



+ Reply to Thread