How to open TCP server for sending file

Hi everyone!

I plan to send file over TCP Server for OTA update.
Below are the working python code run on my windows laptop:

import socket

HOST = str(socket.gethostbyname(socket.gethostname()))
PORT = 8080
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind((HOST, PORT))
s.listen()

while True:
    conn, addr = s.accept()
    # Send file when there is connection...

When I’m using above code in appdaemon. It open ports at 172.30.33.2 which is different from the raspberry pi local ip address 192.168.100.9.

When I try to open port at 192.168.100.9, below error occured:
OSError: [Errno 99] Address not available

Anyone know what’s the problem? I’m using add-on appdaemon.
Is it actually possible to open TCP server and send file using appdaemon?

Seems you are stuck in a Docker network?!

Hi may I know what does it mean?

HA Addons are installed as Docker Containers. Depending on how they are set up one may have restricted access to the hosts network (or some forwarded ports).

Unfortunately I have no idea how this is set up, so can’t help you there - I have never used a HA Addon. But I’m sure you can Google your way with that information.

I see. Thanks for the clarification.

Hi, @alex_a31. I wonder if you have found a solution to this problem? I am facing a similar problem that I need to set up a TCP server with a static IP 192.168.10.xx on AppDaemon to talk to a sensor, but the IP of AppDaemon is 172.30.33.4.
I would really appreciate it if you could enlighten me on how to set the IP of AppDaemon.