从描述符读取响应

问题描述

我正在通过外壳程序脚本(通过在主机和端口上打开描述符)发送消息,服务器也响应了一些消息,但是如何从描述符中读取服务器消息?这是我当前的代码,该命令从命令行发送红色的命令

exec 3<>/dev/tcp/${HOST}/${PORT}
while true; do
echo "Enter command to send to the server"

read MESSAGE;
echo -ne $MESSAGE >&3
echo "sent $MESSAGE to the server"

//add code here to read if the server wrote any response



done



exec 3<&-
exec 3>&-

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)