Re: determining if connection is local
Re: determining if connection is local
- Subject: Re: determining if connection is local
- From: Quinn <email@hidden>
- Date: Thu, 25 Sep 2003 10:43:06 +0100
At 0:17 -0600 25/9/03, Chaz McGarvey wrote:
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.
With regards to getting all of the IP addresses, there are a variety
of techniques available, many of which are covered in Technote 1145
"Living in a Dynamic TCP/IP Environment".
<
http://developer.apple.com/technotes/tn/tn1145.html>
I'm curious why you're checking for a local connection. If you're
doing this for security reasons, you might be able to just check the
source address of the connection against 127.0.0.1. This will
identify normal connections to your port, that is, where the client
has called connect without calling bind, or has bound to INET_ANY.
It will give false negatives if the client has bound to a specific
local IP address, but that's a somewhat bizarre thing to do and false
negatives in a security context aren't bad.
S+E
--
Quinn "The Eskimo!" <
http://www.apple.com/developer/>
Apple Developer Technical Support * Networking, Communications, Hardware
_______________________________________________
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.