STDIN remote address?

X

Xavier Kaotico

Greetings,

I have come up to a stand still here with a small bit of code. My purpose is to figure out the remote IP address associated with stdin. I tried porting the following code (which did this easily in C):

struct sockaddr_in sin;
unsigned int nl = sizeof (struct sockaddr_in);
int test = getpeername (IO_STDIN, (struct sockaddr *) &sin, &nl);

I heard there was a libc call which gave me the exact information I needed, but I have not looked into it yet. Does anyone have any idea how this can be pulled off?

Oh, and the furthest I got was looking into socket.fromfd(), but I got sidetracked.

Thanks in advance!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,191
Latest member
BuyKetoBeez

Latest Threads

Top