From what I read (only the very outline, i do not know C Language) a Socket session is established between a server and a client by calling functions for both of them in a certain order.
It starts with the Server:
socket() #creates communication point
bind() #gives this communication point an address
listen() #tells it to be ready for some signal
then the Client:
socket()
connect() #establishes a line between himself and the listening Server
now both can talk with each other by using read() and write().
Well, this was implemented in the C Programming Language, but could this be done also with the Shell and if so would it make any sense doing it this way?
socat
's command of ptys is particularly relevant tobc
. As an aside, a method I generally find convenient when working w/mkfifo
is get an fd on the pipe then deleting the link before going further. Likemkfifo pipe; exec 3<>pipe; rm pipe; <&3 bc | nc >&3 &
. It saves the cleanup later and is more secure, I think. – mikeserv Apr 01 '15 at 07:14rm
'ing it (and replacing with something else, like a symlink) before the intended code opens it – derobert Apr 01 '15 at 07:30-m
ode of course (had to look it up - it uses the symbolic modes I guess which I find more difficult than 700 but apparentlygo-wr
should do similar) but it probably still wants cleaning up eventually - which is usually my primary impetus. – mikeserv Apr 01 '15 at 07:45