All,
I come from the microcontroller world (pure "C"), and this my first real project using python and embedded linux (Nanopi Neo). Apologies if the question is poorly worded.
I am using a Nanopi Neo board with an Ubuntu distro (16.04.5 LTS). I currently use two interfaces: an wired ethernet connection (eth0) and a wifi wireless connection (wlan0). Both interfaces work, I can see both IP addresses because there is an OLED screen on the board.
I would like to associate a TCP server with the wired interface (eth0), and an HTTP client with the wifi interface (wlan0).
A field technician will connect to the server on the Nanopi in order to setup the credentials for the wifi. Once the credentials have been received, the field technician will disconnect the wired connection, and the HTTP client on the Nanopi will connect to the wifi and it will send information to a remote server.
My questions are the following:
How do I associate the HTTP client with wlan0 and the TCP server with eth0? Is it possible?
How do I write code so that the two tasks (the server and the client) run at the same time (I guess in two separate threads)?
I don't need the answer (even though that would be nice), but useful links. My searches for "interface ", "client/server", "concurrent" brought up all the wrong information/examples ...
Thank you for your time and assistance.
Grazie e ciao, Vincenzo
======= EDIT 1 =======
I have not had a chance to try it, but the following StackOverflow post: How to bind socket to an interface in python (socket.SO_BINDTODEVICE missing) seems to have relevant/useful information