udp failure

Hi there,

I use the below code to send a string to a pc on a local Wi-Fi using udp:

  local myText1= display.newText(“hello world”,200,200,nil,26) 
       --socket test CLIENT 
 local socket = require “socket”
 local address1x, port1x = “192.168.0.101”, 7015

 function sendUdpMsg()
  local udp, errorMsg = socket.udp()  
if udp == nil then
    myText1.text = errorMsg
else 
  udp:settimeout(0)
  udp:setpeername(address1x, port1x)
  local dg = “send me to PC”
  local snd = udp:send(dg)
  print("Sent: " … dg)
 end
end   

local function main()
  sendUdpMsg()
end

main()

it is working fine on the simulator (sending the string), but giving me “permission denied” on the android device (Samsung S4) as the errorMsg. Am using 2013.1202 corona sdk starter.

Any clue?

Tx

Have you added the android.permission.INTERNET to your build.settings file?

http://docs.coronalabs.com/guide/distribution/buildSettings/index.html

Tx Alan. I had missed the build.settings files. It works fine.

Have you added the android.permission.INTERNET to your build.settings file?

http://docs.coronalabs.com/guide/distribution/buildSettings/index.html

Tx Alan. I had missed the build.settings files. It works fine.