Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions mavfwd.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ bool verbose = false;
const char *default_master = "/dev/ttyAMA0";
const int default_baudrate = 115200;
const char *default_out_addr = "127.0.0.1:14600";
const char *default_in_addr = "127.0.0.1:0";
const char *default_in_addr = "0.0.0.0:0";
// RC_CHANNELS (#65) for regular MAVLINK RC Channels read (https://mavlink.io/en/messages/common.html#RC_CHANNELS)
const int RC_CHANNELS = 65;
// RC_CHANNELS_RAW (#35) for ExpressLRS,Crossfire and other RC procotols (https://mavlink.io/en/messages/common.html#RC_CHANNELS_RAW)
Expand Down Expand Up @@ -791,7 +791,7 @@ static int handle_data(

out_sock = socket(AF_INET, SOCK_DGRAM, 0);

int in_sock = 0;
int in_sock = out_sock;

printf("Listening on %s...\n", port_name);

Expand All @@ -804,9 +804,6 @@ static int handle_data(
if (!parse_host_port(out_addr, (struct in_addr *)&sin_out.sin_addr.s_addr, &sin_out.sin_port))
goto err;

if (sin_in.sin_port > 0)
in_sock = socket(AF_INET, SOCK_DGRAM, 0);

if (in_sock > 0 &&
bind(in_sock, (struct sockaddr *)&sin_in, sizeof(sin_in))) { // we may not need this
perror("bind()");
Expand Down