Subj : Sending message to user from protocol To : deepthaw From : Digital Man Date : Thu Nov 12 2020 05:41 pm Re: Sending message to user from protocol By: deepthaw to All on Thu Nov 12 2020 06:32 pm > I'm working on a bash script to generate a URL to download a requested file > via http which can then work as a protocol. > > All of it works, except for sending a message back to the user. I know very > little about socket programming, would this involve the socket passed via > the %h parameter? > > I tried something similar to: > > echo -e "test message\n" | netcat $1 $2 > > Where $1 and $2 map to %i %h (client ip, socket descriptor). But I don't see > anything on the client's end. '%h' would be a socket descriptor. 'netcat' does not accept a socket descriptor as an argument. I think you're passing the socket descriptor where netcat would expect to find a port (TCP or UDP). The easiest way to send a message to a user is to write (append) to the file data/msgs/####.msg where #### is the 0-padded user number. You could pass this value as an argument to your script using the %4 specifier. http://wiki.synchro.net/config:cmdline The node won't know it has a message waiting until you set the "MSGW" flag for the node. This can be done using the exec/node utility. All of these could be done via JS, so consider just writing your entire script in JS. -- digital man Rush quote #32: Begging hands and bleeding hearts will only cry out for more Norco, CA WX: 60.2øF, 54.0% humidity, 6 mph E wind, 0.00 inches rain/24hrs .