diff --git a/nselib/rpc.lua b/nselib/rpc.lua index cb389a7ae..8d26f108e 100644 --- a/nselib/rpc.lua +++ b/nselib/rpc.lua @@ -187,11 +187,15 @@ Comm = { local resvport = math.random(1, 1024) socket = nmap.new_socket("udp") status, err = socket:bind(nil, resvport) - if status then break end - socket:close() + if status then + status, err = socket:connect(host, port) + if status or err == "TIMEOUT" then break end + socket:close() + end end else socket = nmap.new_socket("udp") + status, err = socket:connect(host, port) end end if (not(status)) then