Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

Python 

Socket Question

pastebin . com / raw / Sucjf5bW

So with the code I just shown, it's suppose to make a server so people can chat, I am going to make the client later but for now I need to figure out something to make connecting easier.

In th last print statment it's suppose to show the IP the socket is using.

But it shows 0.0.0.0 as the local IP, I thought if I left it empty it would automatically insert my local IP for me.

But now my question is how do I make it show me the IP.

And can you help me so it shows public and not local?
You can use an external api to get your IP address.
PHP Code

<?php 
Import requests
Import json
with requests
.Session() as s:
        
r = s.get("http://ip-api.com/json", timeout=5)
        
j = json.loads(r.text)
        print(
'my  IP is {0}'.format(j['query'])) 

¸„»°'´¸„»°'´Vorticalbox `'°«„¸`'°«„¸
`'°«„¸¸„»°'´¸„»°'´`'°«„¸Scientia Potentia est ¸„»°'´`'°«„¸`'°«„¸¸„»°'´


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Python] by ghostdeveliteJul 18, 2021 04:21 AM 1 140 Jul 18, 2021 04:21 AM
Last Post: 3phase
[Python] by michalmondayJun 15, 2017 06:58 PM 2 130 Jun 15, 2017 06:58 PM
Last Post: tulamba
[Python] by datguy.devSep 8, 2016 04:42 PM 0 62 Sep 8, 2016 04:42 PM
Last Post: datguy.dev