I want to get the IP address of the client requesting a web page.
According to the docs, RpGetConnectionInformation() should do this; however it returns an IP address of zero (port number is correct).
I also found mention of function RpGetRemoteIpAddress() in these forums - it clearly exists in the libraries, since I can link it in without error, but no documentation on its use.
Has anyone successfully used either of these functions?
int RpGetRemoteIpAddress(void * theTaskDataPointer,
StcpIpAddress * theIpAddress);
the TaskDataPointer is a void pointer to the AWS internal data structure used for most other AWS calls. StcpIpAddress is a synonym for sockaddr_storage. sockaddr-storage can hold either an IP V4 or an IP V6 IP address. If you are not familiar with this type, please read up on it in the API reference guide.
Thanks for that, but RpGetRemoteIpAddress() is returning a zero IP address as well.
I’ve tried the call both in the ‘page start’ routine, and in one of the stubs which returns a value to AWS, with no difference.
Running fully patched ESP 7.4.2.5 on Connectcore 9P 9215, incidentally
When you are calling RpGetConnectionInformation do you have a “login”. That is are you “authenticated” or is this an application that does not require yo to be authenticated. I am not sure but I think to have a connection against which to check for an ip address you needed to have logged in (page belongs to a realm and you get challenged).
The only other thing that comes to mind is that the calls now return a sockaddr_storage instead of just and address. Yo have to ensure you know that “family” of the returned address before dissecting the union. Otherwise you can end of getting 0 because you are looking in the wrong place in the structure
The only other thing that comes to mind is that the calls now return a sockaddr_storage instead of just and address. Yo have to ensure you know that “family” of the returned address before dissecting the union. Otherwise you can end of getting 0 because you are looking in the wrong place in the structure
Turns out this is exactly what my problem was. Because I’m on an IPV4 network, I was looking for an address of type AF_INET.
However with IPV6 enabled, the address returned is always of type AF_INET6
I am having a similar problem with this function. I can see the StcpIpAddress family AF_INET6 and the port number is correct but there is no ipv6 member to this structure. The only members of StcpIpAddress.addr are ipSockAddr and ipv4? The definition of sockaddr_storage in netos72/src/treck/include/trsocket.h is below.