Connect API TCP connection issue

Using code from https://github.com/flyme2bluemoon/InfiniteFlightConnect-Python,

import socket

udp = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
udp.bind(("", 15000))
while True:
    data, addr = udp.recvfrom(4096)
    if data:
        break
udp.close()

IP = addr[0]
PORT = 10112
ADDR = (IP, PORT)

tcp = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
tcp.connect(ADDR)

I am able to receive the UDP packet containing the correct connection information:

{"Addresses":[{CORRECT PHONE IP ADDRESSES}],"Aircraft":"Unknown","DeviceID":"Google Pixel","DeviceName":"Pixel","Livery":"Unknown","Port":10111,"State":"MainMenu","Version":"21.4.0.1565"}

However, attempting to connect via TCP (with the given address and port 10112 (for API v2)) results in

TimeoutError: [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond

Any help is appreciated!

What are you using to connect over TCP?

I’m using python’s builtin socket library to create and use the sockets on my Windows 7 PC. Both the computer and my phone are on the same wifi network.

I was able to get this to work with another device (Google pixel 3a), and the same code and computer, so it might just have been an issue with my pixel.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.