socat
's shut-none
pilihan harus membantu di sini:
Changes the (address dependent) method of shutting down the write part of a connection to not do anything.
Anda mungkin juga perlu mengganti periode batas waktu default menggunakan -t <timeout>
, jika tidak, soket akan ditutup setelah 0,5s. Opsi ini mengesampingkan perilaku default, yaitu:
When one of the streams effectively reaches EOF, the closing phase begins. Socat transfers the EOF condition to the other stream, i.e. tries to shutdown only its write stream, giving it a chance to terminate gracefully. For a defined time socat continues to transfer data in the other direction, but then closes all remaining channels and terminates.
Jadi, sebuah perintah seperti:
echo 'blah' | socat -t 10 stdio tcp:<addr>:<port>,shut-none
akan menjaga soket terbuka selama 10 detik setelah mengirim 'bla'.