On 30 May 2002, Gerald Timothy Quimpo wrote:
> i tried that (getpeername(fileno(stdin)). but i might be using it
> wrong. i'll try again and read the documentation this time.
> thanks :).
there isnt much sample docs online so try this:
struct sockaddr_in i;
int len;
char * addr;
len = sizeof(i);
if (getpeername( fileno(stdin), &i, &len ) == 0)
{
addr = (char *) inet_ntoa(i.sin_addr);
printf("%s\n", addr );
}
hth,
pong
_
Philippine Linux Users Group. Web site and archives at http://plug.linux.org.ph
To leave: send "unsubscribe" in the body to [EMAIL PROTECTED]
To subscribe to the Linux Newbies' List: send "subscribe" in the body to
[EMAIL PROTECTED]