allinurl/gwsocket

Help with FIFO Error. Bad address

daddyfix opened this issue · 11 comments

I built v 0.4.0 on Buster (Raspberry Pi 4 Model B Rev 1.1)

But I get this error when trying to pipein fifo. Any help would be appreciated

$ gwsocket -p 8080 --pipein=/tmp/websocket/wspipein.fifo
 
Fatal error has occurred
Error occured at: src/websocket.c - ws_setfifo - 2292
Unable to set fifo: Bad address.

websocket.c - Line 2279+


/* Create named pipe (FIFO) with the given pipe name.
 *
 * On error, 1 is returned.
 * On success, 0 is returned. */
int
ws_setfifo (const char *pipename) {
  struct stat fistat;
  const char *f = pipename;

  if (access (f, F_OK) == 0)
    return 0;

  if (mkfifo (f, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH) < 0)
    FATAL ("Unable to set fifo: %s.", strerror (errno));
  if (stat (f, &fistat) < 0)
    FATAL ("Unable to stat fifo: %s.", strerror (errno));
  if (!S_ISFIFO (fistat.st_mode))
    FATAL ("pipe is not a fifo: %s.", strerror (errno));

  return 0;
}

Hi, I've the same problem and tried chmod 757 and 777 and 10777 /tmp/ with any effects. Always the same error. I'm using raspberry 4. My best lelis

My gwsocket worked well with Rpi 2. The option as _--pipein=<path/file>_gives the same error but mkfifo in my C program works well even for /tmp/ folder. Anyway, gwsocket is always stopped (bad address) and impossible to use. The best solution could be perhaps to comment this lines and recompile websocket.c but .......Any way I have to switch to Ajax, exec() in PHP and C brrrrrr. My Best lelis

Could you please try passing --pipeout=<path>. e.g.,

gwsocket --pipein=/tmp/wspipein.fifo --pipeout=/tmp/wspipeout.fifo

Seems like I'll need to address the default path. Let me know how it goes. Thanks

By the way, you can also try piping data in. e.g.,

tail -F /var/log/apache2/access.log | gwsocket --std --port 7890

Thanks allinurl for your help. These options gives the same error (bad address) with "my" folder. Do I need to test with /tmp/?. I've just finished to implement my C program to control serial UART via USB0 and would like to send some data from my web page directedly to C interface and external RealTime DSP target. That worked well in Rpi2 and now not really. I've tried mkfifo with address 0777 and was able to generate fifo in /tmp/

Pushed an update. It should solve the issue. There's no need for setting --pipein=/tmp/wspipein.fifo --pipeout=/tmp/wspipeout.fifo as it will use those paths as default.

Please rebase from origin and let me know how it goes.

A lot of thanks allinurl !!!!! For me it works. Bye, bye PHP and its exec() brrrr. lelisele

Pushed an update. It should solve the issue. There's no need for setting --pipein=/tmp/wspipein.fifo --pipeout=/tmp/wspipeout.fifo as it will use those paths as default.

Please rebase from origin and let me know how it goes.

After new build this date it works great on Raspberry Pi 4 (buster) Thanks

Great to hear that. Thanks for letting me know!