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
Printable View
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
"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.
It may be different on Windows systems; I have no way to tell.
--
James Carlson, KISS Network <james.d.carlson@sun.com>
Sun Microsystems / 1 Network Drive 71.232W Vox +1 781 442 2084
MS UBUR02-212 / Burlington MA 01803-2757 42.496N Fax +1 781 442 1677
"James Carlson" <james.d.carlson@sun.com> ha scritto nel messaggio
news:xoav64rks1sc.fsf@sun.com...[color=blue]
> "Gio67" <gio67@ot.ot> writes:[color=green]
> > 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.
>
> It may be different on Windows systems; I have no way to tell.
>
> --
> James Carlson, KISS Network <james.d.carlson@sun.com>
> Sun Microsystems / 1 Network Drive 71.232W Vox +1 781 442 2084
> MS UBUR02-212 / Burlington MA 01803-2757 42.496N Fax +1 781 442 1677[/color]
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
[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]
Search the web. There are hundreds or thousands of them.
--
James Carlson, KISS Network <james.d.carlson@sun.com>
Sun Microsystems / 1 Network Drive 71.232W Vox +1 781 442 2084
MS UBUR02-212 / Burlington MA 01803-2757 42.496N Fax +1 781 442 1677