Sample Header Ad - 728x90

How to access an inetd service?

2 votes
2 answers
571 views
So I created a simple inetd error logging service according to this example https://en.wikipedia.org/wiki/Inetd
#include 
#include 

int main(int argc, char **argv)
{
  const char *fn = argv;
  FILE *fp = fopen(fn, "a+");

  if (fp == NULL) 
    exit(EXIT_FAILURE);

  char str;
  /* inetd passes its information to us in stdin. */
  while (fgets(str, sizeof str, stdin)) {
    fputs(str, fp);
    fflush(fp);
  }
  fclose(fp);
  return 0;
}
I appended this line to `/etc/services/`
errorLogger 9999/udp
and this line to `/etc/inetd.conf`
errorLogger dgram udp wait root /usr/local/bin/errlogd errlogd /tmp/logfile.txt
How can I access this now? I configured the service on my Raspberry Pi in my local network. Do I need to write a client program that accesses the UDP port 9999 or can I do it via SSH? I already tried
ssh pi@raspberrypi -p 9999
but it says `ssh: connect to host raspberrypi port 9999: Connection refused` I also reload the systemd service with
sudo service inetd reload
and it didn't help.
Asked by neolith (273 rep)
Feb 8, 2021, 10:52 AM
Last activity: Feb 8, 2021, 04:09 PM