 
 
 udpConReq = (address, un, key, callback) ->
+  return false if not address
   [host, port] = address.split(':', 2)
+  if port is undefined
+    port = 80
+  else
+    port = parseInt(port)
+    return false if isNaN(port)
 
   ts = Math.trunc(Date.now() / 1000)
   id = Math.trunc(Math.random() * 4294967295)

      password = device.InternetGatewayDevice.ManagementServer.ConnectionRequestPassword?._value

    conReq = () ->
      if udpConnectionRequestAddress
        udpConReq(udpConnectionRequestAddress, username, password, (err) -> throw err if err)

      httpConReq(connectionRequestUrl, username, password, CONNECTION_REQUEST_TIMEOUT, (err) ->
        if udpConnectionRequestAddress
          return callback()
        callback(err)
      )

  sig = crypto.createHmac('sha1', key).update("#{ts}#{id}#{un}#{cn}").digest('hex')
  uri = "http://#{address}?ts=#{ts}&id=#{id}&un=#{un}&cn=#{cn}&sig=#{sig}"

  message = Buffer.from("GET #{uri} HTTP/1.1\r\nHost: #{address}\r\n\r\n")

  client = dgram.createSocket('udp4')

