Skip to content

Commit

Permalink
AP_Scripting: test update
Browse files Browse the repository at this point in the history
  • Loading branch information
tridge committed Sep 29, 2024
1 parent c77b726 commit eea4516
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions libraries/AP_Scripting/examples/net_test.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
example script to test lua socket API
--]]

---@diagnostic disable: param-type-mismatch

local MAV_SEVERITY = {EMERGENCY=0, ALERT=1, CRITICAL=2, ERROR=3, WARNING=4, NOTICE=5, INFO=6, DEBUG=7}

PARAM_TABLE_KEY = 46
Expand Down Expand Up @@ -103,10 +101,13 @@ local function test_server(name, sock)
sock = sock_tcp_in2
end

local r = sock:recv(1024)
local r, ip, port = sock:recv(1024)
if r and #r > 0 then
gcs:send_text(MAV_SEVERITY.ERROR, string.format("test_server(%s): got input '%s'", name, r))
end
if ip then
gcs:send_text(MAV_SEVERITY.INFO, string.format("packet from %s:%u", ipv4_addr_to_string(ip), port))
end
end

local function update()
Expand Down

0 comments on commit eea4516

Please sign in to comment.