allinurl / gwsocket

fast, standalone, language-agnostic WebSocket server RFC6455 compliant
http://gwsocket.io
MIT License
745 stars 67 forks source link

Help with FIFO Error. Bad address #41

Closed daddyfix closed 3 years ago

daddyfix commented 3 years ago

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;
}
ghost commented 3 years ago

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

lelisele commented 3 years ago

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

daddyfix commented 3 years ago

I found out that version 0.3.0 works as expected I'm using that version for now and I will probably have to comment out the mkfifo check in version 0.4.0. thanks for your help I'm going to keep working on it and let you know what happens

On Thu., Jun. 10, 2021, 10:21 a.m. lelisele, @.***> wrote:

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

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/allinurl/gwsocket/issues/41#issuecomment-858664924, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABEIKU32XXWOBYH3X6WFQODTSDC6VANCNFSM46J7V2UA .

allinurl commented 3 years ago

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

allinurl commented 3 years ago

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

tail -F /var/log/apache2/access.log | gwsocket --std --port 7890
lelisele commented 3 years ago

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/

allinurl commented 3 years ago

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.

daddyfix commented 3 years ago

That's great.. will do

On Thu., Jun. 10, 2021, 9:28 p.m. Gerardo O., @.***> wrote:

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.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/allinurl/gwsocket/issues/41#issuecomment-859193963, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABEIKU64HAHVD7PSKK452JTTSFRCDANCNFSM46J7V2UA .

lelisele commented 3 years ago

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

daddyfix commented 3 years ago

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

allinurl commented 3 years ago

Great to hear that. Thanks for letting me know!