Re: IP address from NSFileHandle?
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