get ip address

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
bacardirigoman
New User
New User
Posts: 6
Joined: Sun Feb 20, 2005 10:35 pm

Post by bacardirigoman »

oh... yes... great thank you!
User avatar
GeoTrail
Addict
Addict
Posts: 2794
Joined: Fri Feb 13, 2004 12:45 am
Location: Bergen, Norway
Contact:

Post by GeoTrail »

Great, thanks olejr. And offcourse to Fred :)
I Stepped On A Cornflake!!! Now I'm A Cereal Killer!
Dummy
Enthusiast
Enthusiast
Posts: 162
Joined: Wed Jun 09, 2004 11:10 am
Location: Germany
Contact:

Post by Dummy »

Look at this: viewtopic.php?p=86862

THAT would be nice!
dracflamloc
Addict
Addict
Posts: 1648
Joined: Mon Sep 20, 2004 3:52 pm
Contact:

Post by dracflamloc »

When is this being added fred?
User avatar
geoff
Enthusiast
Enthusiast
Posts: 128
Joined: Sun Apr 27, 2003 12:01 am
Location: Cornwall UK
Contact:

Post by geoff »

Thanks for your procedure olejr
Using purebasic functions and pre-defined structures this can be reduced to:

Code: Select all

Procedure.s GetClientIP(ClientID) 
 s=SizeOf(sockaddr_in)
 res=getpeername_(ClientID,@ip.sockaddr_in,@s) 
 If res = 0 
   remotip$=IPString(ip\sin_addr)
 Else 
   remotip$ = "" 
 EndIf 
 ProcedureReturn remotip$ 
EndProcedure
Gansta93
Enthusiast
Enthusiast
Posts: 238
Joined: Wed Oct 20, 2004 7:16 pm
Location: The Village
Contact:

Post by Gansta93 »

Right, Fred said that it would be included, but it is not... when Fred ?
Be seeing you! :-)

Gansta93
If you speak french, you can visite Le Monde de Gansta93 (Gansta93's World)
Shannara
Addict
Addict
Posts: 1808
Joined: Thu Oct 30, 2003 11:19 pm
Location: Emerald Cove, Unformed

Post by Shannara »

I third this question .. couldn't find a reference in the pb 3.94 help file. I could be missing it?
BarryG
Addict
Addict
Posts: 3331
Joined: Thu Apr 18, 2019 8:17 am

Re:

Post by BarryG »

Fred wrote:Ok, it will be added.
Bump.
freak
PureBasic Team
PureBasic Team
Posts: 5929
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Re: get ip address

Post by freak »

quidquid Latine dictum sit altum videtur
BarryG
Addict
Addict
Posts: 3331
Joined: Thu Apr 18, 2019 8:17 am

Re: get ip address

Post by BarryG »

I didn't know about it. Will that return your external IP address like the topic says? If so, how do we use it? I don't understand the manual for it as I'm not network-savvy.
freak
PureBasic Team
PureBasic Team
Posts: 5929
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Re: get ip address

Post by freak »

The function does what is discussed in this topic: returns the IP of the client connected to your network server. Not your own.

Why do you bump a 15 year old topic if you don't even understand what is asked there? The issue discussed here has been solved for almost as long as the topic exists.

What you are asking for is currently being discussed here: viewtopic.php?f=13&t=74663
quidquid Latine dictum sit altum videtur
Post Reply