views:

90

answers:

1

Hey. I'm coding a cgi in Python, running on an IIS 7.5 web server, on Windows. I would like to get the tcp port (usually was the server environment variable REMOTE_PORT) from which the client is connecting to it.

I've tried to look up all the way throuhout the keys as in os.environ.keys() and I can get the user IP address, his browser, platform, but no remote port available.

I have .NET Framework 3.5 SP1 installed already.

Could anyone please figure out what's happening or a way to make it?

Thanks.

A: 

Googling suggests people with ASP.NET and PHP solutions have similar problems and that since IIS 5.0 that variable hasn't been available. I get the impression you have to call a routine called GetServerVariable() to retrieve it. That routine sounds like it's available through various libraries, which you may be able to use as-is or lift code from:

There are probably others.

Peter Hansen