STDIN remote address?

Xavier Kaotico sabu at
Mon Jan 19 06:22:02 CET 2004


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!
Get your free email from

More information about the Python-list mailing list