IP Adresses in AP/STA mode

tangray
Posts: 6
Joined: Tue Aug 15, 2017 7:37 am

IP Adresses in AP/STA mode

Postby tangray » Sat Jan 06, 2018 4:49 am

Does anybody know ? When working in AP/STA mode how do a force a socket to be connected on either the STA or the AP net. Does LWIP maintain a routing table for each interface. Even then how do I send a broadcast on one or the other . I seem to be missing somehing at the socket bind stage of the API, I feel that I should be telling the socket which interface to use and I can find where to do this in the API call. Maybe in the struct sockaddr_in ???. Thanks .

tangray
Posts: 6
Joined: Tue Aug 15, 2017 7:37 am

Re: IP Adresses in AP/STA mode

Postby tangray » Sat Jan 06, 2018 12:48 pm

Well I seem to have solved this.
Basically one needs to maintain 2 Host IP address one for each interface. When the AP is configured it is assigned and IP address of ones choosing and the STA receives and IP adr by DHCP (normally). In AP/STA mode these need to be managed seperately. The LWIP stack tracks and routes TX packets to the corrrect interface by this address.

cmorgan
Posts: 89
Joined: Thu Aug 24, 2017 12:52 am

Re: IP Adresses in AP/STA mode

Postby cmorgan » Sat Jan 06, 2018 3:00 pm

Are you receiving connections or connecting outwardly? When receiving you'll specify the address to listen to when you call bind().

On outgoing connections I'm a bit less sure how that works. I'd be interested in seeing some code to show what you mean and how you've resolved the issue.

Who is online

Users browsing this forum: Google [Bot] and 254 guests