TCP / IP问题 [英] TCP /IP question
问题描述
所以我正在使用套接字类,我正在连接到另一台设备。
So I am using a socket class and I am connecting to another device.
我发出一个命令,然后设备发回回复
I send out a command and the device sends back a reply
但我不知道答复会持续多长时间。
but I do not know how long the reply is going to be.
我有没有办法继续听,直到完成?
is there a way for me to keep listening until it is done ?
我现在要去看这个
Robot.Send(command3);
byte[] buffer3 = null;
Robot.Receive(buffer3);
我发送一个命令然后我读了回复的
I send a command and then I read the replied
但是设备发送了返回更多那一行
but the device send back more that one line
我怎样才能读取其他行呢?
how can I read the other lines too ?
推荐答案
您好,
使用套接字类时,可以调用方法Available()。  这将告诉
When using Socket Class, you can call the method Available(). This will tell
您有更多数据需要阅读。 有
you that there is more data to be read. There multiply coding schema for
的多重编码模式处理服务器/客户端数据传输。如果没有看到代码的详细信息
handling server/client data transfers. Without see the details of your code
,那么我只能提供基本套接字类的基本建议。
then I can only offer basic suggestions on the base Socket Class.
希望这会有所帮助:)
hope this helps :)
这篇关于TCP / IP问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!