get the remote port number

I have a c++ cgi script that gets called and I get the IP address of the client like so:

char* remote_host = getenv("REMOTE_ADDR");

But I need to get the remote client port numer as well. I believe that APACHE doesn't set the REMOTE_PORT so can I get it using sin_port or anyting??

How can I do this???

Thanks
Topic archived. No new replies allowed.