Re: ax25d and STDIN

From: Tomi Manninen OH2BNS (zfortgzf@viope.com)
Date: Fri Sep 27 2002 - 10:52:47 EEST

  • Next message: Ben Gelb: "Re: ax25d and STDIN"

    On 27 Sep 2002, Ben Gelb wrote:

    > To output data I am using fopen("php://stdout", "w"); and to read data I
    > am using fopen("php://stdin", "r"); The writing data part works fine,
    > but whenever I attempt to read in data from stdin, ax25d hangs up.

    What do you mean by ax25d hanging up?

    After spawning a program ax25d doesn't actively participate in the
    communication between the program and the connectee. To spawn a program it
    simply does a fork() followed by an exec(). The programs stdin/out/err are
    redirected to point at the incoming connection socket (dup2()) before the
    exec call.

    What you may be seeing is the side effect of AX.25 sockets being
    SOCK_SEQPACKET sockets. This means you always have to read a full packet
    when reading. If you read less than a full packet worth of data, the rest
    of the packet is thrown away. In practise you have no way of knowing how
    big packet there might be waiting in the kernel buffers so you will have
    to do a read() with a buffer "big enough"...

    The standard IO libraries do various amounts of buffering if you use stdio
    functions to read so that might explain why something works and something
    else does not.

    Then again you might be having some completely another problem with your
    program... :)

    -- 
    Tomi Manninen           Internet:  efq.ovzzv@proxy02.plaut.at
    OH2BNS                  AX.25:     rnkzickd@nci2000.net
    KP20ME04                Amprnet:   vprwykxz@bbklaw.com
    

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



    This archive was generated by hypermail 2b30 : Fri Sep 27 2002 - 10:53:10 EEST