RE: ax25d and STDIN

From: Ben Gelb (cvggm@ministry.se)
Date: Mon Sep 30 2002 - 01:14:39 EEST

  • Next message: Craig Small: "Re: Unwanted Broadcast"

    I think I am going to stick with my hack. It works fine for the amount
    of data I will be inputting at a time (less than 80 chars) so I don't
    forsee any problems.

    There is no real way to do a low-level read() in php, not that I am
    aware of anyway, and the setbuf() family of functions doesn't exist.

    Thanks for your help, perhaps I'll consider using C next time, but I
    really want an uncompiled language so I can make changes quickly if
    problems arise. I think I mentioned that before.

    73 Ben

    -----Original Message-----
    From: yqu@azintl.edu
    [mailto:eanp.vzwntor@robot.szukacz.pl] On Behalf Of Tomi Manninen
    Sent: Sunday, September 29, 2002 2:27 PM
    To: Ben Gelb
    Cc: terhi.victor@logonet.com
    Subject: Re: ax25d and STDIN

    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:  hhbkv@ncmissouri.edu
    OH2BNS                  AX.25:     spziv.wbdkuf@nks.net
    KP20ME04                Amprnet:   tbgpd@flextronics.com
    

    - To unsubscribe from this list: send the line "unsubscribe linux-hams" in the body of a message to terhi.victor@logonet.com More majordomo info at http://vger.kernel.org/majordomo-info.html

    - To unsubscribe from this list: send the line "unsubscribe linux-hams" in the body of a message to uzmzfu@fleggaard.com More majordomo info at http://vger.kernel.org/majordomo-info.html



    This archive was generated by hypermail 2b30 : Mon Sep 30 2002 - 01:15:05 EEST