Getting the remote IP-Adress

Everything else that doesn't fall into one of the other PB categories.
merendo
Enthusiast
Enthusiast
Posts: 449
Joined: Sat Apr 26, 2003 7:24 pm
Location: Germany
Contact:

Getting the remote IP-Adress

Post by merendo »

Hi all

I have a network question: How can i retrieve the remote adress of a network client? This is the adress, thru which the client is connected to the server. I need to retrieve this adress on the client side.

Example:

[Server: 192.168.0.1] <--> [Client: 192.168.0.2]

the remote adress of the client would be 192.168.0.2 . The problem is, that if the client has more than one IP adress i don't know which one is the right one.

Thanks for any help! merendo
The truth is never confined to a single number - especially scientific truth!
Proteus
Enthusiast
Enthusiast
Posts: 113
Joined: Wed Sep 17, 2003 8:04 pm
Location: The Netherlands

Post by Proteus »

P4 2.4GHz, 256 MB, WinXP Pro, onboard video&audio.
The Programmer's Drinking Song:
"99 little bugs in the code,
99 little bugs.
Fix one bug, recompile
100 little bugs in the code."
merendo
Enthusiast
Enthusiast
Posts: 449
Joined: Sat Apr 26, 2003 7:24 pm
Location: Germany
Contact:

Post by merendo »

Exactly! But I need to retrieve the localip$ on the client side. Not on the server side :(
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6172
Joined: Sat May 17, 2003 11:31 am
Contact:

Post by blueznl »

strange question but... what would you need it for?
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB - upgrade incoming...)
( The path to enlightenment and the PureBasic Survival Guide right here... )
merendo
Enthusiast
Enthusiast
Posts: 449
Joined: Sat Apr 26, 2003 7:24 pm
Location: Germany
Contact:

Post by merendo »

Little security check for a chat programme... Since an earlier version of that progamme has been cracked, i used to be more careful.
Proteus
Enthusiast
Enthusiast
Posts: 113
Joined: Wed Sep 17, 2003 8:04 pm
Location: The Netherlands

Post by Proteus »

The code works on the client side as well. Just run it after connecting to the server, and store put the connection ID in the cnid var...
P4 2.4GHz, 256 MB, WinXP Pro, onboard video&audio.
The Programmer's Drinking Song:
"99 little bugs in the code,
99 little bugs.
Fix one bug, recompile
100 little bugs in the code."
merendo
Enthusiast
Enthusiast
Posts: 449
Joined: Sat Apr 26, 2003 7:24 pm
Location: Germany
Contact:

Post by merendo »

Looks like it really works. Thank you very much indeed! :D :D :D
Post Reply