this is the content of test.py:
< H1 >! / usr/bin/python < / H1 > print "hello"
a=raw_input ()
print a
now I execute. / test.py
in the linux terminal. I will first print the hello, and then prompt me for input, and finally print the input result, as shown below, no problem:
hello
1
1
but if I hang this test.py under a port:
socat tcp-l:9992,fork exec:./test.py
then nc this port on another local terminal:
nc 127.0.0.1 9992
will let me enter a first, and then print the hello, final output a, as follows:
1
hello
1
this is obviously not in line with the expected execution order, where is the reason, please answer, thank you!