Board index FlightGear Support Interfacing

Problems using udp to send input to fg

Connecting two computers, using generic protocol, connecting with Matlab?

Problems using udp to send input to fg

Postby RuiRui » Mon Feb 11, 2019 6:30 pm

Hello, although I read a lot of posts about how to use udp socket to send inputs to FG, but I still can not succeed. Could you please have a look?
I want to set 'throttle' as 0.9
This is the udp client codes:
Code (client.c): Select all
#pragma comment(lib,"ws2_32.lib")
#pragma warning(disable:4996)
int main(int argc, char * argv[])
SOCKET socketfd;
struct sockaddr_in my_addr;
char buf[80]="0.9";

if (WSAStartup(MAKEWORD(2, 2), &data) != 0)
return 0;

socketfd = socket(AF_INET, SOCK_DGRAM, 0);
if (socketfd<0)
return 0;
my_addr.sin_family = AF_INET;
my_addr.sin_port = htons(8000);
my_addr.sin_addr.S_un.S_addr = inet_addr("");
while (1)
int ret=sendto(socketfd, buf, strlen(buf), 0, (struct sockaddr *)&my_addr, sizeof(my_addr));
printf("ret is:\n%d\n", ret);
return 0;

This is XML file(sendsocket):
Code (sensockt.xml): Select all
<?xml version="1.0"?>



I want to change throttle.

And I run FG first, used
then run the client codes.

But I see the property browser in FG, there is no change. But socket send successfully.
Is there anybody know reasons?
Posts: 1
Joined: Mon Feb 11, 2019 6:20 pm

Return to Interfacing

Who is online

Users browsing this forum: No registered users and 1 guest