H E L P ! ! !
[Please email your response to me as well as posting to the ng.
Thanks.]
I am writing a port responder program (triggered by inetd) and am
having a rather odd problem: As long as I am only sending output (to
'stdout') the program runs fine. I can use the Windows telnet program
to connect to my custom port and I see the "Hello World" message from
my program.
The problem begins with any calls to an input routine using 'stdin'
(such as fscanf(), read(), getchar()). While the program runs fine
when called from the shell, it fails when called by inetd. I don't
even get the "Hello World" message.
I have tried turning on logging (inetd -l) to find out why the program
is failing, but cannot find anything in the system logs.
SPECS:
======
I am using HP-UX version A.09.04 with the default cc compiler (K&R
79).
The following entry is in /etc/services:
pbpcgvi 7244/tcp
The following entry is in /etc/inetd.conf:
pbpcgvi stream tcp nowait root /users/djperk/pbpcgvi pbpcgvi
A sample program that works as a port responder is:
-----------------------------------------------------------
#include <stdio.h>
main()
{
fprintf(stdout,"Port responder test.\n\r\n\r");
-----------------------------------------------------------Quote:}
And the a sample program that fails as a port responder is:
-----------------------------------------------------------
#include <stdio.h>
main()
{
char inp_char;
fprintf(stdout,"Port responder test.\n\r\n\r");
inp_char = getchar();
fprintf(stdout,inp_char);
-----------------------------------------------------------Quote:}
----------------------------------------------------------------------
----------------------------------------------------------------------