• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: determining if connection is local
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Follow-Ups:
    • Re: determining if connection is local
      • From: Chaz McGarvey <email@hidden>
References: 
 >determining if connection is local (From: Chaz McGarvey <email@hidden>)

  • Prev by Date: Re: determining if connection is local
  • Next by Date: Apple-approved way to listen on well known ports?
  • Previous by thread: Re: determining if connection is local
  • Next by thread: Re: determining if connection is local
  • Index(es):
    • Date
    • Thread