Re: ax25d and STDIN

From: Tomi Manninen (terhi.victor@logonet.com)
Date: Sun Sep 29 2002 - 21:26:51 EEST

  • Next message: barry: "Unwanted Broadcast"

    On 28 Sep 2002, Ben Gelb wrote:

    > Using fread with a large length doesn't work, because EOF is never found
    > in stdin. So it just keeps waiting for the number of bytes specified.

    Actually I Don't think it's EOF that is missed. You would expect to see
    EOF only when the user disconnects. It's probably that the io stream is
    fully buffered. Playing with the setbuf() family of functions (if
    available in php, perl or whatever you use, I don't know) might be a
    solution.

    > I don't really understand why this works with the SEQPACKET
    > consideration. I am definitely not getting the whole packet at once,
    > yet, as I said, it does work.

    Your code (which I believe in some form uses the libc stdio library)
    buffers the reads and the actual low level read() is called with a buffer
    larger than what you specify. The default is probably the machine page
    size. I think that's why it works.

    I have found that the safest option is to directly use a low level read()
    call and handle any buffering my self. I don't know if that is an option
    for you however. So after all your hack might the best solution.

    -- 
    Tomi Manninen           Internet:  qgqwg.ybcefgspu@motiva.fi
    OH2BNS                  AX.25:     zcqscc.qiyrphdse@sme.cz
    KP20ME04                Amprnet:   eoppgyd.szkj@ccdarchitects.com
    

    - To unsubscribe from this list: send the line "unsubscribe linux-hams" in the body of a message to nmu.dhwsrm@mail.dy.fi More majordomo info at http://vger.kernel.org/majordomo-info.html



    This archive was generated by hypermail 2b30 : Sun Sep 29 2002 - 21:27:11 EEST