How to make an Echo server with Bash?

后端 未结 5 1470
伪装坚强ぢ
伪装坚强ぢ 2020-12-12 20:58

How to write a echo server bash script using tools like nc, echo, xargs, etc capable of simultaneously processing requests from multiple clients each with durable connection

5条回答
  •  难免孤独
    2020-12-12 21:38

    In case ncat is not an option, socat will also work:

    socat TCP4-LISTEN:2000,fork EXEC:cat
    

    The fork is necessary so multiple connections can be accepted. Adding reuseaddr to TCP4-LISTEN may be convenient.

提交回复
热议问题