To know IP Address of client

1,496 views
Skip to first unread message

Phyo Arkar

unread,
Dec 20, 2008, 6:30:28 PM12/20/08
to web...@googlegroups.com
Hi All;

How can i know the IP address of the Client who access the Page? Is that from Request object right?But which ?

Regards,

Phyo.

Phyo Arkar

unread,
Dec 20, 2008, 6:49:42 PM12/20/08
to web...@googlegroups.com
Got it , it is

request.env.http_host

Where can i find all the properties of Request Response and Session objects?

Regards,

Phyo.

Phyo Arkar

unread,
Dec 20, 2008, 6:52:50 PM12/20/08
to web...@googlegroups.com

AHH no no this . it is just server ip:port .. how can i find browser client's IP ?

vince

unread,
Dec 20, 2008, 7:18:40 PM12/20/08
to web2py Web Framework
request.client

On Dec 21, 7:52 am, "Phyo Arkar" <phyo.arkarl...@gmail.com> wrote:
> AHH no no this . it is just server ip:port .. how can i find browser
> client's IP ?
>
> On Sat, Dec 20, 2008 at 11:49 PM, Phyo Arkar <phyo.arkarl...@gmail.com>wrote:
>
> > Got it , it is
>
> > request.env.http_host
>
> > Where can i find all the properties of Request Response and Session
> > objects?
>
> > Regards,
>
> > Phyo.
>

mdipierro

unread,
Dec 21, 2008, 1:50:46 AM12/21/08
to web2py Web Framework
there are some shortcomings of the http protocol.

If there is no proxy the address is in request.env.remote_addr
If there is a proxy the addresses been proxied are in
request.env.http_x_forwarded_for

But you do not know if there is a proxy in between you and the client.

web2py looks in both tries to figure out it and stored the best guess
for client address in request.client.

Problem. request.env.http_x_forwarded_for can be spoofed thus
request.client may be spoofed too.

This is not a web2py problem. This is a problem of the HTTP protocol.

Massimo

Phyo Arkar

unread,
Dec 21, 2008, 5:37:29 AM12/21/08
to web...@googlegroups.com
Dear vince ;

Thanks a lot , after posting last message , i found that correct one is request.vars.client.

Dear Massimo;

Thanks . I am on an interesting project , it is for p2p based Web Camera via just the browser.

So what i am doing now is NAT Tranversal using Java Applet Via STUN Protocol.

When STUN Negotiation is done and Applet got the response from STUN server , it Report back to the Server which is running web2py via HTTPOST. Then it stores the IP on the Database.

It Reports Local IP , NAT Type , Interface , Public IP

But in cases of NAT Tranversal cannot accomplish (example , UDP blocked) We cannot know the External IP of the Client.

For that case My Idea is to recieve the IP Address of External IP via Web2py .

This will atleast get the Extermal IP of the Client , Whether  it is Proxied or NATted.




Regards,

Phyo.
Reply all
Reply to author
Forward
0 new messages