how to get Client IP Address

Hi,
I am using RCM 3000 and i have created the server side program which accepts the clients connection and get the messages from the client but i am unable to get the clients IP address.
Can any body suggest me the way or the function name to find out the client IP address.

Any help is appreatiable.
Thanks in advance.

Your function will be passed an HttpState, often referred to in the examples as ‘state’.

tcp_Socket *ourS;
struct sockaddr sock_addr;
char tempstr[32];

ourS = http_getSocket(state);
getpeername((sock_type *)ourS, &sock_addr, NULL);
inet_ntoa(tempstr, sock_addr.s_ip);
printf("This function was accessed by %s
", tempstr);

That’s the basic idea. When your custom handler is called by the TCP/IP stack, the IP address of the caller is included in the state structure.