Skip to content

Instantly share code, notes, and snippets.

@hotpxl
Last active March 1, 2023 03:43
Show Gist options
  • Save hotpxl/a8b318bc02a69b24d17a894c5ee1158b to your computer and use it in GitHub Desktop.
Save hotpxl/a8b318bc02a69b24d17a894c5ee1158b to your computer and use it in GitHub Desktop.
Connect Microsoft Flight Simulator on Shadow to ForeFlight

Background

ForeFlight listens to UDP traffic on port 49002 for information from flight simulators. It integrates GPS, AHRS, and traffic data, giving you a very similar experience to an ADS-B In unit.

Microsoft Flight Simulator doesn't natively support this, but fs2ff is a very easy-to-use plugin that bridges the gap. You can download an executable binary from the release page and you are ready to go.

However, I run Microsoft Flight Simulator on Shadow, and to show flight information on my local ForeFlight, I need to forward the flight data. The following steps should technically work with other cloud gaming platforms as well.

Steps

  1. On your local network's router, enable port forwarding so UDP traffic from the public interface's port 49002 can reach the local iPad.
  2. Start Microsoft Flight Simulator and fs2ff. In fs2ff, deselect Auto-detect and enter 127.0.0.1 for the IP address.
  3. Run forward.py. It forwards all remote 49002 UDP traffic to local.
import socket
forward_dest = "AAA.BBB.CCC.DDD"
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
send_sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock.bind(("127.0.0.1", 49002))
print("Started")
while True:
data, _ = sock.recvfrom(1024)
print("Received", data.decode())
send_sock.sendto(data, (forward_dest, 49002))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment