From: Ben Gelb <ben@gelbnet.com>
To: tpm@prkele.tky.hut.fi
Cc: linux-hams@vger.kernel.org
Subject: Re: ax25d and STDIN
Date: 28 Sep 2002 01:19:53 -0400 [thread overview]
Message-ID: <1033190393.2665.53.camel@ben> (raw)
In-Reply-To: <Pine.LNX.4.44.0209280150590.31315-100000@oh2bns.ampr.org>
Thanks for helping me with this.
I have made some progress.
I have replaced the line where I originally tried to use fgets, with
this wierd hacky solution:
while(1) {
$c = fread($in, 1);
if($c == $RETURN_CHAR) break;
$in_string.= $c;
}
The program works as intended now.
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.
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.
Does this make any sense to you?
Thanks for you help!
73 Ben
On Fri, 2002-09-27 at 19:09, Tomi Manninen wrote:
> Hi again Ben,
>
> > 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.
>
> Ok, so it is probably not the SEQPACKET problem either. However I really
> can't think of any other explanation than a problem with your program.
>
> As I said when someone connects to your system, ax25d accept()s the
> connection, then fork()s. The parent process (ax25d) closes the socket
> belonging to the incoming connection thereby completely detaching itself
> from it. Ax25d then continues as if it never knew about that connection.
>
> The child process copies the incoming connecting socket to it's
> stdin/out/err and then exec()s your program. After that your program has
> full control over the connection. Only your program can close the
> connection.
>
> Well, there is another possibility and that is that the kernel closes the
> connection for some reason. I think some misconfiguration of the kernel
> ax25 support could cause that to happen.
>
> Anyway my first guess still is that there is something wrong with your
> program. Are you absolutely 100% sure that ax25d manages to start it?
> Could the read fail for some other reason? Have you tried logging exactly
> what fails? I recommend making your program log each and every possible
> error situation somewhere, maybe the system log.
>
> --
> Tomi Manninen Internet: oh2bns@sral.fi
> OH2BNS AX.25: oh2bns@oh2rbi.fin.eu
> KP20ME04 Amprnet: oh2bns@oh2rbi.ampr.org
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-hams" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2002-09-28 5:19 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-09-27 5:08 ax25d and STDIN Ben Gelb
2002-09-27 7:52 ` Tomi Manninen OH2BNS
2002-09-27 11:34 ` Ben Gelb
2002-09-27 23:09 ` Tomi Manninen
2002-09-28 5:19 ` Ben Gelb [this message]
2002-09-29 18:26 ` Tomi Manninen
2002-09-29 22:14 ` Ben Gelb
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1033190393.2665.53.camel@ben \
--to=ben@gelbnet.com \
--cc=linux-hams@vger.kernel.org \
--cc=tpm@prkele.tky.hut.fi \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.