++++++++++++++++++++++++++++++++++++++++++++++++++ + C socket handler versus xinetd ++++++++++++++++++++++++++++++++++++++++++++++++++ | Less than a hour after writing about a C server that handles connections and | distribute them to another programs, **inetd** came to my mind and I thought: | "nice! Maybe I can create the Vila without writing this component". So, I went | after inetd to see what it is capable of. | | | The truth is: it is not what I was looking for. inetd (or `xinetd`, in my case) | is kind of a MONSTER. It is intended to listen to all ports and handle lots of | protocols and perform a lot of other functions instead just listening to ONE | single port and calling other program to handle the connections. | And, besides that, I couldn't find a way to run xinetd as an unprivileged user, | since it insisted in using /etc/services as a parameter for validating my | custom services (and failing, preventing me to run them). | | | It's a shame. I would love to use a pre-existing application as the connection | handler. | | | | I proceeded, then, to write my own server. I managed to make it work reasonably | well with 64 lines of C code, including passing along all environment variables | from the server to the forked program. | | | It works in a very, very simple fashion: bind to an address, accept a | connection, fork. These last two in an infinite loop. I believe the forking | process will be fast enough to not block connections. | Maybe. | | | My mother called me, today. She is very happy with the newly installed "rural | phone", that is a regular GSM chip installed on a old-style-like telephone | device that plugs into an external antenna. It's powerful enough to get signal | even on reasonably remote places. | It has an USB cable that you can plug into your computer and use it as an | external modem. My father tried it and the system didn't detected the phone, | so he called me to ask for some instructions. | Sorry: unable to do that thus remotely. At least some log reading is needed. | And MAYBE I uninstalled `ModemManager` or something like that. I hope it is not | the case... | | | | I was hoping to record a new video for my channel today, but all this research | about inetd plus the struggle to make the C server to work properly (I kind of | lost some of my old C skills and am trying to recover that) rendered it | impossible. | Tomorrow, maybe...