The example below creates a TCP server listening on a stream (i.e. SOCK_STREAM
) socket. A similar approach can be followed to
create a UDP server on a datagram (i.e. SOCK_DGRAM
) socket. See man systemd.socket
for details.
Create an simple echo server at /opt/foo/serve.py
.