首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >udp通信matlab中的控制超时值

udp通信matlab中的控制超时值
EN

Stack Overflow用户
提问于 2016-03-12 17:48:23
回答 1查看 713关注 0票数 0

如何在UDP通信中设置“超时值”?我收到警告:

代码语言:javascript
运行
复制
Warning: Unsuccessful read:  The specified amount of data was not returned within the Timeout period. 

我想增加超时值,这样我就不会原谅这个警告了.

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-03-13 12:25:22

若要设置超时,可以使用:

代码语言:javascript
运行
复制
u.Timeout=99;

在这种情况下,超时属性没有文档化,至少我找不到任何文档。在处理未知或未完全记录的对象时,我通常尝试使用get methodsproperties来检查它们:

代码语言:javascript
运行
复制
>> 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.,另外两个方法将显示所有可访问的内容。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/35961202

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档