• 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: IP address from NSFileHandle?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: IP address from NSFileHandle?


  • Subject: Re: IP address from NSFileHandle?
  • From: Pontus Ilbring <email@hidden>
  • Date: Sun, 11 Sep 2005 12:27:12 +0200

On 9/11/05, Andrew Bush <email@hidden> wrote:
> Hi all,
>
> is this possible?  Im playing around with the bonjour examples
> picturesharer and picturebrowser.
>
> what I would like to do is tweak the server code such that it captures
> the ip address of the incoming connection.
>
> It looks and feels as if there should be some way to do what I want by
> doing <something> with the file descriptor of the NSFileHandle that the
> notification passes in, but Im not finding anything in google or
> elsewhere.

I think you do something like this (code written in mail, not tested):

struct sockaddr_in address;
socklen_t length = sizeof(address);

int error = getpeername([myfilehandle fileDescriptor], (struct
sockaddr *) &address, &length);
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >IP address from NSFileHandle? (From: Andrew Bush <email@hidden>)

  • Prev by Date: Re: Old NeXT code
  • Next by Date: Re: _newFirstResponderAfterResigining
  • Previous by thread: IP address from NSFileHandle?
  • Next by thread: bindings update controls etc before awakeFromNib ?
  • Index(es):
    • Date
    • Thread