Hi,
I start a ppp connection from my modem to a RAS server.
The RAS server have an IP address and give me a IP address.
I need to read, from a my C application the IP of the RAS.
How can I do it ?
Thank you in advance

10-02-2007, 03:59 PM

unix

Re: IP address

"Gio67" <gio67@ot.ot> writes:[color=blue]
> I start a ppp connection from my modem to a RAS server.
> The RAS server have an IP address and give me a IP address.
> I need to read, from a my C application the IP of the RAS.
> How can I do it ?[/color]

It depends on your operating system.

Typically, you read out interface addresses using the BSD sockets
ioctls -- in particular, SIOCGIFCONF and SIOCGIFADDR.

Thank you.
I use linux kernel 2.6.x, then I have to open the /dev/ppp0 device and then
make ioctl (SIOCGIFCONF ....)
It' s right ?
Do you have an example of that ?
Bye

10-02-2007, 03:59 PM

unix

Re: IP address

[Please don't both post and send me email. Pick one.]

"Gio67" <gio67@ot.ot> writes:[color=blue]
> I use linux kernel 2.6.x, then I have to open the /dev/ppp0 device and then
> make ioctl (SIOCGIFCONF ....)
> It' s right ?[/color]

No. Applications should not be fooling around with network device
nodes unless they have a need to do so. And network device nodes know
_nothing_ of what IP is doing or how IP is configured.

The common SIOCGIFCONF ioctl is a BSD sockets ioctl. This means that
it works on a socket. Create a socket (just a simple UDP one will do)
by calling the socket() function, and issue the ioctl on that.
[color=blue]
> Do you have an example of that ?[/color]