Open 3 terminals, which I'll call A, B, and C, and execute the following:
socat TCP-LISTEN:12345,fork -
in A,pidof socat
in B,socat TCP-CONNECT:localhost:12345 -
in C,pidof socat
again in B.Step 2 will print 1 PID, whereas step 4 will print 3 PIDs, meaning that step 3 spawned 2 processes (whereas step 1 definitely spawned only 1).
Why is that? Is it an (uniteresting?) implementation detail of socat
? Or is it necessary for socat
to work?
It's no surprise socat
listener spawns an extra process as it is literally instructed to do so by option fork
.
Removing fork
results in just two PIDs printed by step 4.