# UDPSocket.send(Object object)

Sends messages to the specified IP and port.

# Parameters

# Object object

Attribute Type Default Required Description
address string Yes The IP address to send the message to. This must be in the same range as the mobile phone's IP address.
port number Yes The port number to send the message to
message string/ArrayBuffer Yes The data to be sent
offset number 0 No The offset of the sent data, which is valid only when the message is of type ArrayBuffer.
length number message.byteLength No The length of the sent data, which is valid only when the message is of type ArrayBuffer.

# Sample Code


  const udp = wx.createUDPSocket()
  udp.bind()
  udp.send({
    address: '192.168.193.2',
    port: 8848,
    message: 'hello, how are you'
  })

点击咨询小助手