freelanceprogrammers.org Forum Index » Perl

how to get the client`s IP address..


View user's profile Post To page top
kgopal_sh Posted: Fri Jan 20, 2006 9:02 am


Joined: 24 Dec 2005

Posts: 8
how to get the client`s IP address..
i`m using io::sockets::inet to listen for incoming sockets,
how do i obtain my client`s IP address.. or hostname..

any body .. will know this answer please express..

Thanks
gopi.
Reply with quote
Send private message
View user's profile Post To page top
dhana_foru Posted: Fri Jan 20, 2006 5:53 pm


Joined: 20 Jan 2006

Posts: 1
how to get the client`s IP address..
Hi
just try this. u can get ip and subnet mask. if u want ge the host name , u
can use win32::GetHostName()..

#To find IP address and subnet mask of the system.
$p=system("ipconfig >x.txt");
if(!$p)
{
open(FH,"<x.txt");
while(<FH>)
{
chop;
#To find IP addresses
#
if (m/(IP.*:D)(d+.d+.d+.d+)/)

{
print "IP ADDRESS IS $2";
}
#To find Subnet Mask


if(m/(Subnet.*:)/)

{
print "SUB NET MASK IS $`";
}
}
}


kgopal_sh <kgopal_sh@...> wrote: i`m using io::sockets::inet to listen
for incoming sockets,
how do i obtain my client`s IP address.. or hostname..

any body .. will know this answer please express..

Thanks
gopi.








---------------------------------
YAHOO! GROUPS LINKS


Visit your group "Perl_Official" on the web.

To unsubscribe from this group, send an email to:
Perl_Official-unsubscribe@yahoogroups.com

Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.


---------------------------------






---------------------------------
Yahoo! Photos – Showcase holiday pictures in hardcover
Photo Books. You design it and we’ll bind it!

[Non-text portions of this message have been removed]
Reply with quote
Send private message
View user's profile Post To page top
kgopal_sh Posted: Sat Jan 21, 2006 10:02 am


Joined: 24 Dec 2005

Posts: 8
how to get the client`s IP address..
Thanks for quick response dhana,
But having one dout, iam checking CPAN in that win32::GetHostName() is not
there..
ok..
any have iam using io::sockets::inet module .. in that i need to get Host
name and IP address .. i checked in CPAN and i think so "peerAddre()" is using
getting the Host name and IP ..
but i dont know exactly.. can u verify this and express is it right r not?
because i dont have that much exp.. on this now only i get into this..Perl.

Thanks for acknowledge and i am waiting for u r response...

Thanks
gopi.

"Dhanapalan.C" <dhana_foru@...> wrote:
Hi
just try this. u can get ip and subnet mask. if u want ge the host name , u can
use win32::GetHostName()..

#To find IP address and subnet mask of the system.
$p=system("ipconfig >x.txt");
if(!$p)
{
open(FH,"<x.txt");
while(<FH>)
{
chop;
#To find IP addresses
#
if (m/(IP.*:D)(d+.d+.d+.d+)/)

{
print "IP ADDRESS IS $2";
}
#To find Subnet Mask


if(m/(Subnet.*:)/)

{
print "SUB NET MASK IS $`";
}
}
}


kgopal_sh <kgopal_sh@...> wrote: i`m using io::sockets::inet to listen
for incoming sockets,
how do i obtain my client`s IP address.. or hostname..

any body .. will know this answer please express..

Thanks
gopi.








---------------------------------
YAHOO! GROUPS LINKS


Visit your group "Perl_Official" on the web.

To unsubscribe from this group, send an email to:
Perl_Official-unsubscribe@yahoogroups.com

Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.


---------------------------------






---------------------------------
Yahoo! Photos – Showcase holiday pictures in hardcover
Photo Books. You design it and we’ll bind it!

[Non-text portions of this message have been removed]





SPONSORED LINKS
C programming language Computer programming languages Java
programming language The c programming language C programming language
Concept of programming language

---------------------------------
YAHOO! GROUPS LINKS


Visit your group "Perl_Official" on the web.

To unsubscribe from this group, send an email to:
Perl_Official-unsubscribe@yahoogroups.com

Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.


---------------------------------






---------------------------------

What are the most popular cars? Find out at Yahoo! Autos

[Non-text portions of this message have been removed]
Reply with quote
Send private message
View user's profile Post To page top
Rob_Wilson_98 Posted: Tue Jan 24, 2006 8:07 pm


Joined: 02 Aug 1999

Posts: 11
how to get the client`s IP address..
--- In Perl_Official@yahoogroups.com, gopal singh <kgopal_sh@y...> wrote:
>
> Thanks for quick response dhana,
> But having one dout, iam checking CPAN in that
win32::GetHostName() is not there..
> ok..
> any have iam using io::sockets::inet module .. in that i need
to get Host name and IP address .. i checked in CPAN and i think so
"peerAddre()" is using getting the Host name and IP ..
> but i dont know exactly.. can u verify this and express is it
right r not? because i dont have that much exp.. on this now only i
get into this..Perl.
>
> Thanks for acknowledge and i am waiting for u r response...
>
> Thanks
> gopi.
>

After you perform an accept(), you will get a new socket object. This
object has the method peerhost() which will return the IP address of
the peer (client).
Reply with quote
Send private message
Post new topic Reply to topic
Display posts from previous:   
 

All times are GMT
Page 1 of 1
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Freelace Website Designer - Customer web design and software building.
China Wholesale - Electronics Products
Character Studio - Tutorials and Help