I mean, ifconfig, and capture the ip…

Enviado do meu iPhone

Em 21 de set. de 2023, à(s) 08:24, Gustavo Soares 
<gustavo.felipesoa...@hotmail.com> escreveu:


Hi, Petro!

 I use this struct:

[image.png]

and this where I use the inet_ntoa:

[image.png]
________________________________
De: Petro Karashchenko <petro.karashche...@gmail.com>
Enviado: quinta-feira, 21 de setembro de 2023 08:16
Para: dev@nuttx.apache.org <dev@nuttx.apache.org>
Assunto: Re: different IP than expected

Hi,

But what do you pass to "inet_ntoa"? Maybe you get the IP of your PC or a 
default router IP and try to print it?

Best regards,
Petro

чт, 21 вер. 2023 р. о 14:06 Gustavo Soares 
<gustavo.felipesoa...@hotmail.com<mailto:gustavo.felipesoa...@hotmail.com>> 
пише:
I don't know if I can reproduce this in another app, but my question is why 
does the server listen to requests in one IP adress (ending with 15) and when I 
retrieve its IP it shows a different one? About the ifconfig command, this is 
the output:

[cid:a8ad1b83-824f-40bd-878a-ed966f0ec86c]

the server response to the GET request (the request was sent to the configured 
IP using ifconfig):
[cid:ed334f4b-c3a6-46b2-8915-bfee764fcb45]

the IP address the server returns with the inet_ntoa() method:
[cid:0b98a371-8281-4c40-9354-7b8ed0b093aa]

________________________________
From: Petro Karashchenko 
<petro.karashche...@gmail.com<mailto:petro.karashche...@gmail.com>>
Sent: Thursday, September 21, 2023 6:59:01 AM
To: dev@nuttx.apache.org<mailto:dev@nuttx.apache.org> 
<dev@nuttx.apache.org<mailto:dev@nuttx.apache.org>>
Subject: Re: different IP than expected

Hi,

"INADDR_ANY" definitely does not match "listens to the defined IP" statement. I 
do not understand exactly what you are trying to do, but it would be good to 
know what is the output of "ifconfig" running from NSH.
If you do not want to share code details, maybe you can check how your 
application behaves on Linux and compare to what behavior you observe with 
NuttX.
Can this somehow be reproduced with one of the apps available in the NuttX repo?

Best regards,
Petro

чт, 21 вер. 2023 р. о 03:09 Gustavo Soares 
<gustavo.felipesoa...@hotmail.com<mailto:gustavo.felipesoa...@hotmail.com>> 
пише:
Hello everyone!

 I configured NuttX to a certain IP address and I have a webserver which 
listens to the defined IP:

[X]

[X]

The HTML file above has a variable that contains the server IP address, but it 
is a different one:

[X]

the server replaces the text SERVER_IP_ADDRESS to it's actual IP and then sends 
the file to the client. This is the method I used to get the IP address:

[X]

Why is it a different IP? The server is listening to one but this method 
returns another one.


Reply via email to