# Communication over LAN

Base library 2.4.0 provides a variety of mDNS APIs such as wx.startLocalServiceDiscovery to get the IP addresses of devices that provide mDNS services in the LAN. The url parameter for wx.request/wx.connectSocket/wx.uploadFile/wx.downloadFile should be in the format of ${IP}:${PORT}/${PATH}. The request or connection is successful only when the IP address is in the same IP address range as the mobile phone's IP address but is different from the local device's IP address (generally, it is in the same LAN, for example, connected to the same Wi-Fi network).

In this case, no security domain check is performed and https/wss is not necessarily required (http/ws can be used instead).

wx.request({
  url: 'http://10.9.176.40:828'
  // The other parameters are omitted
})

wx.connectSocket({
  url: 'ws://10.9.176.42:828'
  // The other parameters are omitted
})

From base library 2.7.0 and later, we provide the wx.createUDPSocket API for UDP communication. The above communication rules apply, that is, only communication with an IP address (different from the local device's IP address) in the same LAN is allowed.