MATLAB 帮助中心
本页翻译不是最新的。点击此处可查看最新英文版本。
为通过 TCP/IP 与远程主机的通信清空缓冲区
flush(t)
flush(t,"input")
flush(t,"output")
flush(t) 清空 TCP/IP 客户端 t 指定的远程主机的输入和输出缓冲区中的所有数据。
t
示例
flush(t,"input") 仅清空输入缓冲区。
flush(t,"output") 仅清空输出缓冲区。
全部折叠
使用 IP 地址 172.28.154.231 和端口 4012 创建一个名为 t 的 TCP/IP 客户端。
172.28.154.231
4012
t = tcpclient("172.28.154.231",4012)
t = tcpclient with properties: Address: '172.28.154.231' Port: 4012 NumBytesAvailable: 0 Show all properties, functions
向远程主机写入一些数据,并查看输入缓冲区中可供读取的字节数。
write(t,1:5,"uint8") t.NumBytesAvailable
ans = 5
清空输入和输出缓冲区。
查看可供读取的字节数。
t.NumBytesAvailable
ans = 0
输入缓冲区中没有数据。
tcpclient
TCP/IP 客户端,指定为 tcpclient 对象。
示例: flush(t) 清空来自 TCP/IP 客户端 t 的数据。
在 R2020b 中推出
read
write
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
选择网站
选择网站以获取翻译的可用内容,以及查看当地活动和优惠。根据您的位置,我们建议您选择:。
您也可以从以下列表中选择网站:
如何获得最佳网站性能
选择中国网站(中文或英文)以获得最佳网站性能。其他 MathWorks 国家/地区网站并未针对您所在位置的访问进行优化。
美洲
欧洲
亚太
联系您当地的办事处