UDP插件API文档(Uniapp)
    正在准备搜索索引...

    类型别名 UtsUdpServerSendMessage

    UDP服务端发送消息

    type UtsUdpServerSendMessage = {
        destAddress?: string;
        destPort?: number;
        dataType: string;
        data?: string;
        byteData?: number[];
    }
    索引

    属性

    destAddress?: string

    目标地址。不同socket类型含义不一样

    • 单播 : 指定为目标IP地址。必填。
    • 广播 : 指定广播的网络地址,例如:192.168.50.255代表192.168.50.x子网的广播。255.255.255.255代表全网广播
    • 组播 : 无用值。可以忽略本参数
    destPort?: number

    目标端口。不同socket类型含义不一样

    • 单播 : 指定为目标端口。必填并且不能为0
    • 广播 : 指定广播的端口。必填并且不能为0
    • 组播 : 指定组播的端口。必填并且不能为0
    dataType: string

    数据类型

    • text : 文本,使用UTF-8编码
    • hex : 十六进制HEX字符串格式
    • byte : byte数组
    data?: string

    字符串数据,当dataType为texthex类型的时候使用

    byteData?: number[]

    byte数组数据,当dataType为byte类型的时候使用