Re: ax25d and STDIN

From: Ben Gelb (yrepob@mailit.tunk.net)
Date: Fri Sep 27 2002 - 14:34:11 EEST

  • Next message: Arnau Sánchez: "mkiss problem in kernel 2.5"

    When I say 'hangs up' I mean that the user is disconnected from the ax25
    link. I should have been more specific. For some reason, the link dies.

    I was using fgets to read data. I tried using fread with length of 1024,
    2048, and 10000. It was no different.

    I doubt the problem is in my program. It basically asks the user for a
    line of input, which it them spits back out again. It is simply a test
    program. It works fine on the console (yes, I remembered to change the
    return character to '\r' when I run it with ax25d).

    I am starting to sense there may not be an easy solution to this
    problem.

    Thanks for answering so quickly!

    73 Ben

    On Fri, 2002-09-27 at 03:52, Tomi Manninen OH2BNS wrote:
    > 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: mxf.oggpwnp@mx.dy.fi
    > OH2BNS AX.25: mexkvne.rkhq@uvoz.cz
    > KP20ME04 Amprnet: dratvojf.pkmn@mail.dy.fi
    >
    > -
    > To unsubscribe from this list: send the line "unsubscribe linux-hams" in
    > the body of a message to ivjqbxxk.qctpol@coxfiber.net
    > 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 bimp.gtlj@huskyenergy.ca
    More majordomo info at http://vger.kernel.org/majordomo-info.html



    This archive was generated by hypermail 2b30 : Fri Sep 27 2002 - 14:34:38 EEST