RE: different IP than expected

2023-09-21 Thread Gustavo Soares
I use those arrays to read the request and send the response, there is no stack 
overflow error. I've defined a IP value  inside the server file (#define) and 
it worked as intended, but I want to be able to read the IP from Kconfig 
instead of having it in the server file, I'll be looking for a way to do this.

Thank you all for the support!




De: Gregory Nutt 
Enviado: quinta-feira, 21 de setembro de 2023 10:45
Para: dev@nuttx.apache.org 
Assunto: Re: different IP than expected

On 9/21/2023 6:34 AM, Simon Filgis wrote:
> When I started with networking, I set the IP via kconfig. I remember that
> it was necessary to enter the same IP at two different places. Netlib and
> FTP server in my case. Maybe your IP is overwritten by another app? A
> buildin app that you use for experiments?

Something as simple as stack overflow might be the issue.  There are
some huge arrays on the stack that might be causing issues:

 struct sockaddr_in address;
 int opt = 1;
 int addrlen = sizeof(address);
/char buffer[2048] = {0};//
//char response[4096] = {0};/
 const char *file = "/data/client.html";

So it is going to need a stack allocation of something like 8Kb.


Re: different IP than expected

2023-09-21 Thread Gregory Nutt

On 9/21/2023 6:34 AM, Simon Filgis wrote:

When I started with networking, I set the IP via kconfig. I remember that
it was necessary to enter the same IP at two different places. Netlib and
FTP server in my case. Maybe your IP is overwritten by another app? A
buildin app that you use for experiments?


Something as simple as stack overflow might be the issue.  There are 
some huge arrays on the stack that might be causing issues:


    struct sockaddr_in address;
    int opt = 1;
    int addrlen = sizeof(address);
/    char buffer[2048] = {0};//
//    char response[4096] = {0};/
    const char *file = "/data/client.html";

So it is going to need a stack allocation of something like 8Kb.


Re: different IP than expected

2023-09-21 Thread Gregory Nutt

On 9/21/2023 6:53 AM, Petro Karashchenko wrote:

setting "address.sin_addr.s_addr" + "bind" is kind of a way you can use to
receive requests only from an interface that has a specific IP address.
This is useful if your system has multiple network interfaces and you want
to provide some kind of isolation.
"address.sin_addr.s_addr = INADDR_ANY;" + "bind" is a way that you say "I
want to receive requests from any interface".


That is the way other server logic works.  See 
apps/netutils/netlib_server.c and apps/netutuils/netlib_listenon.c.


The only part that confuses me is that INADDR_ANY is zero. address is 
passed to bind() as read-only, const.  So address.sin_addr should still 
be zero.




Re: different IP than expected

2023-09-21 Thread Petro Karashchenko
setting "address.sin_addr.s_addr" + "bind" is kind of a way you can use to
receive requests only from an interface that has a specific IP address.
This is useful if your system has multiple network interfaces and you want
to provide some kind of isolation.
"address.sin_addr.s_addr = INADDR_ANY;" + "bind" is a way that you say "I
want to receive requests from any interface".

So this does not have any relation to the interface you configure via
menuconfig. Obviously if you will set "address.sin_addr.s_addr" to address
configured via menuconfig it will work.

чт, 21 вер. 2023 р. о 15:44 Gustavo Soares 
пише:

> So setting a value for the IP address in Kconfig and assigning it to
> address.sin_addr.s_addr should solve the problem?
> 
> De: Petro Karashchenko 
> Enviado: quinta-feira, 21 de setembro de 2023 09:35
> Para: dev@nuttx.apache.org 
> Assunto: Re: different IP than expected
>
> I think that you misunderstood the data flow a bit.
>
> So you have
> ...
> address.sin_family = AF_INET;
> address.sin_addr.s_addr = INADDR_ANY;
> address.sin_port = htons(PORT);
>
> if (bind(server_fd, (struct sockaddr *), sizeof(address)) < 0)
> {
> perror("bind failed");
> exit(EXIT_FAILURE);
> }
> ...
> printf("waiting for requests at %s:%d...\n",
> inet_ntoa(address.sin_addr), PORT);
>
> So you assign INADDR_ANY to a address.sin_addr.s_addrand then call "int
> bind(int sockfd, FAR const struct sockaddr *addr, socklen_t addrlen);" that
> has "const" modifier for "addr" parameter hoping that it will modify the
> value that you just assigned. That just simply will not work.
>
> чт, 21 вер. 2023 р. о 15:22 Gustavo Soares <
> gustavo.felipesoa...@hotmail.com<mailto:gustavo.felipesoa...@hotmail.com>>
> пише:
> I've attached a simpler version of the server file removing the logic for
> the incoming requests so you can take a better look. How should I make the
> API call to get the device IP?
> 
> De: Petro Karashchenko  petro.karashche...@gmail.com>>
> Enviado: quinta-feira, 21 de setembro de 2023 09:00
> Para: dev@nuttx.apache.org<mailto:dev@nuttx.apache.org> <
> dev@nuttx.apache.org<mailto:dev@nuttx.apache.org>>
> Assunto: Re: different IP than expected
>
> Yeah,
>
> But what is in between
> [image.png]
> and
> [image.png]
> ???
>
> Do you have any API call to get the IP? Because I read that like "int a =
> 10; printf("%d", a);"
>
> If there is no API call to update "address" then you simply will print
> "INADDR_ANY" value.
>
> чт, 21 вер. 2023 р. о 14:42 MIGUEL ALEXANDRE WISINTAINER <
> tcpipc...@hotmail.com<mailto:tcpipc...@hotmail.com>> пише:
> 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<mailto: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<mailto:dev@nuttx.apache.org> <
> dev@nuttx.apache.org<mailto: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:
>
> [X]
>
> the server response to the GET request (the request was sent to the
> configured IP using ifconfig):
> [X]
>
> the IP address the server returns with the inet_ntoa() method:
> [X]
>
> 
> From: Petro Karashchenko  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,
>
> "

RE: different IP than expected

2023-09-21 Thread Gustavo Soares
So setting a value for the IP address in Kconfig and assigning it to 
address.sin_addr.s_addr should solve the problem?

De: Petro Karashchenko 
Enviado: quinta-feira, 21 de setembro de 2023 09:35
Para: dev@nuttx.apache.org 
Assunto: Re: different IP than expected

I think that you misunderstood the data flow a bit.

So you have
...
address.sin_family = AF_INET;
address.sin_addr.s_addr = INADDR_ANY;
address.sin_port = htons(PORT);

if (bind(server_fd, (struct sockaddr *), sizeof(address)) < 0)
{
perror("bind failed");
exit(EXIT_FAILURE);
}
...
printf("waiting for requests at %s:%d...\n", inet_ntoa(address.sin_addr), 
PORT);

So you assign INADDR_ANY to a address.sin_addr.s_addrand then call "int 
bind(int sockfd, FAR const struct sockaddr *addr, socklen_t addrlen);" that has 
"const" modifier for "addr" parameter hoping that it will modify the value that 
you just assigned. That just simply will not work.

чт, 21 вер. 2023 р. о 15:22 Gustavo Soares 
mailto:gustavo.felipesoa...@hotmail.com>> 
пише:
I've attached a simpler version of the server file removing the logic for the 
incoming requests so you can take a better look. How should I make the API call 
to get the device IP?

De: Petro Karashchenko 
mailto:petro.karashche...@gmail.com>>
Enviado: quinta-feira, 21 de setembro de 2023 09:00
Para: dev@nuttx.apache.org<mailto:dev@nuttx.apache.org> 
mailto:dev@nuttx.apache.org>>
Assunto: Re: different IP than expected

Yeah,

But what is in between
[image.png]
and
[image.png]
???

Do you have any API call to get the IP? Because I read that like "int a = 10; 
printf("%d", a);"

If there is no API call to update "address" then you simply will print 
"INADDR_ANY" value.

чт, 21 вер. 2023 р. о 14:42 MIGUEL ALEXANDRE WISINTAINER 
mailto:tcpipc...@hotmail.com>> пише:
I mean, ifconfig, and capture the ip…

Enviado do meu iPhone

Em 21 de set. de 2023, à(s) 08:24, Gustavo Soares 
mailto: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 
mailto:petro.karashche...@gmail.com>>
Enviado: quinta-feira, 21 de setembro de 2023 08:16
Para: dev@nuttx.apache.org<mailto:dev@nuttx.apache.org> 
mailto: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 
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:

[X]

the server response to the GET request (the request was sent to the configured 
IP using ifconfig):
[X]

the IP address the server returns with the inet_ntoa() method:
[X]


From: Petro Karashchenko 
mailto:petro.karashche...@gmail.com>>
Sent: Thursday, September 21, 2023 6:59:01 AM
To: dev@nuttx.apache.org<mailto: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 
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.




Re: different IP than expected

2023-09-21 Thread Petro Karashchenko
I think that you misunderstood the data flow a bit.

So you have
...
address.sin_family = AF_INET;
address.sin_addr.s_addr = INADDR_ANY;
address.sin_port = htons(PORT);

if (bind(server_fd, (struct sockaddr *), sizeof(address)) < 0)
{
perror("bind failed");
exit(EXIT_FAILURE);
}
...
printf("waiting for requests at %s:%d...\n",
inet_ntoa(address.sin_addr), PORT);

So you assign INADDR_ANY to a address.sin_addr.s_addrand then call "int
bind(int sockfd, FAR const struct sockaddr *addr, socklen_t addrlen);" that
has "const" modifier for "addr" parameter hoping that it will modify the
value that you just assigned. That just simply will not work.

чт, 21 вер. 2023 р. о 15:22 Gustavo Soares 
пише:

> I've attached a simpler version of the server file removing the logic for
> the incoming requests so you can take a better look. How should I make the
> API call to get the device IP?
> --
> *De:* Petro Karashchenko 
> *Enviado:* quinta-feira, 21 de setembro de 2023 09:00
> *Para:* dev@nuttx.apache.org 
> *Assunto:* Re: different IP than expected
>
> Yeah,
>
> But what is in between
> [image: image.png]
> and
> [image: image.png]
> ???
>
> Do you have any API call to get the IP? Because I read that like "int a =
> 10; printf("%d", a);"
>
> If there is no API call to update "address" then you simply will print
> "INADDR_ANY" value.
>
> чт, 21 вер. 2023 р. о 14:42 MIGUEL ALEXANDRE WISINTAINER <
> tcpipc...@hotmail.com> пише:
>
> 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: image.png]
>
> and this where I use the inet_ntoa:
>
> [image: image.png]
> --
> *De:* Petro Karashchenko 
> *Enviado:* quinta-feira, 21 de setembro de 2023 08:16
> *Para:* 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> пише:
>
> 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:
>
>
>
> the server response to the GET request (the request was sent to the
> configured IP using ifconfig):
>
>
> the IP address the server returns with the inet_ntoa() method:
>
>
> --
> *From:* Petro Karashchenko 
> *Sent:* Thursday, September 21, 2023 6:59:01 AM
> *To:* 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> пише:
>
> Hello everyone!
>
>  I configured NuttX to a certain IP address and I have a webserver which
> listens to the defined IP:
>
>
>
>
>
> The HTML file above has a variable that contains the server IP address,
> but it is a different one:
>
>
>
> 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:
>
>
>
> Why is it a different IP? The server is listening to one but this method
> returns another one.
>
>
>


Re: different IP than expected

2023-09-21 Thread Simon Filgis
When I started with networking, I set the IP via kconfig. I remember that
it was necessary to enter the same IP at two different places. Netlib and
FTP server in my case. Maybe your IP is overwritten by another app? A
buildin app that you use for experiments?

--
Ingenieurbüro-Filgis
USt-IdNr.: DE305343278
--
sent by mobile phone

Gregory Nutt  schrieb am Do., 21. Sept. 2023, 14:21:

>
> On 9/21/2023 5:06 AM, Gustavo Soares wrote:
> > Why is it a different IP? The server is listening to one but this
> > method returns another one.
>
> You provide almost no information for anyone to really help you.
>
> Where is the server and client?  It sounds like you are saying that the
> HTTP server is on some remote platform.  Is that right? The client logic
> is on the NuttX target, correct?
>
> You seem to be saying that you connect to the remote server, then do an
> HTTP GET.  The remote IP address in the returned message is not the same
> as the IP address that you connected to.  That is what I am hearing.
>
> What does this have to do with NuttX?  I suggest that you run some
> sniffer like WireShark so you can see what the real point-to-point
> traffic.  The content returned to NuttX has nothing to do with NuttX.
>
> Or have I got that wrong.  You need to communicate more.
>
>


RE: different IP than expected

2023-09-21 Thread Gustavo Soares
I've attached a simpler version of the server file removing the logic for the 
incoming requests so you can take a better look. How should I make the API call 
to get the device IP?

De: Petro Karashchenko 
Enviado: quinta-feira, 21 de setembro de 2023 09:00
Para: dev@nuttx.apache.org 
Assunto: Re: different IP than expected

Yeah,

But what is in between
[image.png]
and
[image.png]
???

Do you have any API call to get the IP? Because I read that like "int a = 10; 
printf("%d", a);"

If there is no API call to update "address" then you simply will print 
"INADDR_ANY" value.

чт, 21 вер. 2023 р. о 14:42 MIGUEL ALEXANDRE WISINTAINER 
mailto:tcpipc...@hotmail.com>> пише:
I mean, ifconfig, and capture the ip…

Enviado do meu iPhone

Em 21 de set. de 2023, à(s) 08:24, Gustavo Soares 
mailto: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 
mailto:petro.karashche...@gmail.com>>
Enviado: quinta-feira, 21 de setembro de 2023 08:16
Para: dev@nuttx.apache.org<mailto:dev@nuttx.apache.org> 
mailto: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 
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:

[X]

the server response to the GET request (the request was sent to the configured 
IP using ifconfig):
[X]

the IP address the server returns with the inet_ntoa() method:
[X]


From: Petro Karashchenko 
mailto:petro.karashche...@gmail.com>>
Sent: Thursday, September 21, 2023 6:59:01 AM
To: dev@nuttx.apache.org<mailto: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 
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.


int main(int argc, char *argv[]) 
{
int server_fd, new_socket, valread;
struct sockaddr_in address;
int opt = 1;
int addrlen = sizeof(address);
char buffer[2048] = {0};
char response[4096] = {0};
const char *file = "/data/client.html";
bool executing = false;

if ((server_fd = socket(AF_INET, SOCK_STREAM, 0)) == 0)
{
perror("socket failed");
exit(EXIT_FAILURE);
}

if (setsockopt(server_fd, SOL_SOCKET, SO_REUSEADDR, , sizeof(opt)))
{
perror("setsockopt");
exit(EXIT_FAILURE);
}

address.sin_family = AF_INET;
address.sin_addr.s_addr = INADDR_ANY;
address.sin_port = htons(PORT);

if (bind(server_fd, (struct sockaddr *), sizeof(address)) < 0)
{
perror("bind failed");
exit(EXIT_FAILURE);
}
if (listen(server_fd, 3) < 0)
{
perror("listen");
exit(EXIT_FAILURE);
}

printf("waiting for requests at %s:%d...\n", inet_ntoa(address.sin_addr), 
PORT);

while (1)
{
// web server logic for requests
}

return 0;
}


Re: different IP than expected

2023-09-21 Thread Gregory Nutt



On 9/21/2023 5:06 AM, Gustavo Soares wrote:
Why is it a different IP? The server is listening to one but this 
method returns another one.


You provide almost no information for anyone to really help you.

Where is the server and client?  It sounds like you are saying that the 
HTTP server is on some remote platform.  Is that right? The client logic 
is on the NuttX target, correct?


You seem to be saying that you connect to the remote server, then do an 
HTTP GET.  The remote IP address in the returned message is not the same 
as the IP address that you connected to.  That is what I am hearing.


What does this have to do with NuttX?  I suggest that you run some 
sniffer like WireShark so you can see what the real point-to-point 
traffic.  The content returned to NuttX has nothing to do with NuttX.


Or have I got that wrong.  You need to communicate more.



Re: different IP than expected

2023-09-21 Thread Petro Karashchenko
Yeah,

But what is in between
[image: image.png]
and
[image: image.png]
???

Do you have any API call to get the IP? Because I read that like "int a =
10; printf("%d", a);"

If there is no API call to update "address" then you simply will print
"INADDR_ANY" value.

чт, 21 вер. 2023 р. о 14:42 MIGUEL ALEXANDRE WISINTAINER <
tcpipc...@hotmail.com> пише:

> 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: image.png]
>
> and this where I use the inet_ntoa:
>
> [image: image.png]
> --
> *De:* Petro Karashchenko 
> *Enviado:* quinta-feira, 21 de setembro de 2023 08:16
> *Para:* 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> пише:
>
> 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:
>
>
>
> the server response to the GET request (the request was sent to the
> configured IP using ifconfig):
>
>
> the IP address the server returns with the inet_ntoa() method:
>
>
> --
> *From:* Petro Karashchenko 
> *Sent:* Thursday, September 21, 2023 6:59:01 AM
> *To:* 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> пише:
>
> Hello everyone!
>
>  I configured NuttX to a certain IP address and I have a webserver which
> listens to the defined IP:
>
>
>
>
>
> The HTML file above has a variable that contains the server IP address,
> but it is a different one:
>
>
>
> 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:
>
>
>
> Why is it a different IP? The server is listening to one but this method
> returns another one.
>
>
>


Re: different IP than expected

2023-09-21 Thread MIGUEL ALEXANDRE WISINTAINER
I mean, ifconfig, and capture the ip…

Enviado do meu iPhone

Em 21 de set. de 2023, à(s) 08:24, Gustavo Soares 
 escreveu:


Hi, Petro!

 I use this struct:

[image.png]

and this where I use the inet_ntoa:

[image.png]

De: Petro Karashchenko 
Enviado: quinta-feira, 21 de setembro de 2023 08:16
Para: 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 
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 
mailto:petro.karashche...@gmail.com>>
Sent: Thursday, September 21, 2023 6:59:01 AM
To: dev@nuttx.apache.org<mailto: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 
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.




Re: different IP than expected

2023-09-21 Thread MIGUEL ALEXANDRE WISINTAINER
Can the gustavo application do oscall to the utility that returns the ip ?

Enviado do meu iPhone

Em 21 de set. de 2023, à(s) 08:17, Petro Karashchenko 
 escreveu:


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 
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 
mailto:petro.karashche...@gmail.com>>
Sent: Thursday, September 21, 2023 6:59:01 AM
To: dev@nuttx.apache.org<mailto: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 
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.


[image.png]


RE: different IP than expected

2023-09-21 Thread Gustavo Soares
Hi, Petro!

 I use this struct:

[cid:55c45c09-3f8e-4479-9315-f70a156c8f0f]

and this where I use the inet_ntoa:

[cid:7b74168e-0e07-4c3c-ba95-32016a361340]

De: Petro Karashchenko 
Enviado: quinta-feira, 21 de setembro de 2023 08:16
Para: 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 
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 
mailto:petro.karashche...@gmail.com>>
Sent: Thursday, September 21, 2023 6:59:01 AM
To: dev@nuttx.apache.org<mailto: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 
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.




Re: different IP than expected

2023-09-21 Thread Petro Karashchenko
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 
пише:

> Hello everyone!
>
>  I configured NuttX to a certain IP address and I have a webserver which
> listens to the defined IP:
>
>
>
>
>
> The HTML file above has a variable that contains the server IP address,
> but it is a different one:
>
>
>
> 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:
>
>
>
> Why is it a different IP? The server is listening to one but this method
> returns another one.
>
>


different IP than expected

2023-09-20 Thread Gustavo Soares
Hello everyone!

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

[cid:820c9f69-369e-403b-8928-15a97245100a]

[cid:a42eded4-3e24-4b28-b0a7-07170d21a404]

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

[cid:5e9d6cae-0b80-47cd-a05d-f9d52e1fdf80]

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:

[cid:f59e2b66-2f08-4aa7-895c-936b962eab26]

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