A beginner question


#1

Hello,

I have a (basic) question regarding the WIP plugin.

Using the HTTP GET sample, I managed to make a HTTP Post application. But now I need to know the Ip-adres of the bearer, is there command for that? I tried this:

//check ip
ascii tmpbuf[256];
wip_getOpts(ch, wip_getOpts, tmpbuf, WIP_COPT_END);
TRACE((1, "ipadres is %d", tmpbuf));

but this returns

Trace IP 1 ipadres is 27458808

Using my post example, I can catch the ip-adres from the sender (trough an aspx script), and it’s something in the range of 81.169.104.xx
So can I find that Ip from the WIP?

Thank you


#2

Still can’t get the IP … :frowning:

Is it possible to get the Ip from a connected TCP client too?
So I made a TCP server, and a client connects, can I get this connected ip-adres?

Thank you


#3

an address is attached to a bearer, so if you have several bearers opened, you have several addresses. Choose the bearer which gives you the address you’re interested in, and extract the address as an option:

// Warning! untested code
wip_bearer_t  b;
wip_in_addr_t ip_addr;
ascii         str_ip_addr[16];
...
// get binary address:
wip_bearerGetOpts( b, WIP_BOPT_IP_ADDR, & ip_addr, WIP_BOPT_END);
// put it into textual form:
wip_inet_ntoa( ip_addr, str_ip_addr, sizeof( str_ip_addr));
// use it:
wip_debug( "My address is %s\n", str_ip_addr);