如何在UDP通信中设置“超时值”?我收到警告:
Warning: Unsuccessful read: The specified amount of data was not returned within the Timeout period.
我想增加超时值,这样我就不会原谅这个警告了.
发布于 2016-03-13 12:25:22
若要设置超时,可以使用:
u.Timeout=99;
在这种情况下,超时属性没有文档化,至少我找不到任何文档。在处理未知或未完全记录的对象时,我通常尝试使用get
methods
和properties
来检查它们:
>> methods(x)
Methods for class udp:
Contents eq fscanf instrhelp ne size
binblockread fclose fwrite instrhwinfo obj2mfile stopasync
binblockwrite fgetl get instrnotify open subsasgn
class fgets horzcat instrument openvar subsref
close fieldnames icinterface isa propinfo udp
ctranspose flushinput igetfield isequal query vertcat
delete flushoutput inspect isetfield readasync
disp fopen instrcallback isvalid record
display fprintf instrfind length scanstr
end fread instrfindall methods set
>> properties(x)
No properties for class udp or no class udp.
>> get(x)
ByteOrder = bigEndian
BytesAvailable = 0
BytesAvailableFcn =
BytesAvailableFcnCount = 48
BytesAvailableFcnMode = terminator
BytesToOutput = 0
ErrorFcn =
InputBufferSize = 512
Name = UDP-127.0.0.1
ObjectVisibility = on
OutputBufferSize = 512
OutputEmptyFcn =
RecordDetail = compact
RecordMode = overwrite
RecordName = record.txt
RecordStatus = off
Status = open
Tag =
Timeout = 3
TimerFcn =
TimerPeriod = 1
TransferStatus = idle
Type = udp
UserData = []
ValuesReceived = 0
ValuesSent = 0
UDP specific properties:
DatagramAddress =
DatagramPort = []
DatagramReceivedFcn =
DatagramTerminateMode = on
InputDatagramPacketSize = 512
LocalHost =
LocalPort = 52148
LocalPortMode = auto
OutputDatagramPacketSize = 512
ReadAsyncMode = continuous
RemoteHost = 127.0.0.1
RemotePort = 9090
Terminator = LF
请注意,并不总是支持get
。如果您接收到Error using get Conversion to double from A is not possible.
,另外两个方法将显示所有可访问的内容。
https://stackoverflow.com/questions/35961202
复制相似问题