Re: determining if connection is local
Re: determining if connection is local
- Subject: Re: determining if connection is local
- From: Joshua Graessley <email@hidden>
- Date: Thu, 25 Sep 2003 11:21:38 -0700
Please don't use the ioctl directly, it's difficult to get right. If
you're going to use that, try getifaddrs instead. As Quinn noted, you
shouldn't do this for "security".
-josh
On Sep 24, 2003, at 11:39 PM, Justin C. Walker wrote:
>
On Wednesday, September 24, 2003, at 11:17 PM, Chaz McGarvey wrote:
>
>
> Hello:
>
>
>
> Using BSD sockets, I'm looking for a way to determine of a recently
>
> accept()ed socket corresponds to a connection from the same computer.
>
> I would know how to do this if I knew how to get a list of all the
>
> possible IP addresses for the computer.
>
>
Sure. Commands like netstat and ifconfig can get that list. For one,
>
there's a sysctl that gives you the list. In addition, there's a
>
('obsolete') ioctl (SIOCGCONF) that will do it. Check the darwin
>
source (network_cmds project). Also, the book by W. Richard Stevens
>
(Unix Network Programming, V1, 2nd Ed, Prentice Hall) is a great aid
>
in figuring out this kind of question for BSD-derived systems.
>
There's code on his website (http://www.kohala.com) that comes from
>
his book.
>
>
Regards,
>
>
Justin
>
>
--
>
Justin C. Walker, Curmudgeon-At-Large *
>
Institute for General Semantics | It's not whether you win or
>
lose...
>
| It's whether *I* win or lose.
>
*--------------------------------------
>
*-------------------------------*
>
_______________________________________________
>
macnetworkprog mailing list | email@hidden
>
Help/Unsubscribe/Archives:
>
http://www.lists.apple.com/mailman/listinfo/macnetworkprog
>
Do not post admin requests to the list. They will be ignored.
[demime 0.98b removed an attachment of type application/pkcs7-signature which had a name of smime.p7s]
_______________________________________________
macnetworkprog mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/macnetworkprog
Do not post admin requests to the list. They will be ignored.