GithubHelp home page GithubHelp logo

Comments (8)

HelloZeroNet avatar HelloZeroNet commented on April 28, 2024

Thanks for reporting!
cc: @sirMackk

from zeronet.

sirMackk avatar sirMackk commented on April 28, 2024

Hey @arthurlutz , thanks for reporting this. I'll get on fixing this today evening. Could you please share what OS you're using as well as Python version?

from zeronet.

sirMackk avatar sirMackk commented on April 28, 2024

I think I have the fix for this on my fork's master. I'll get to give it a test on two routers tomorrow and hopefully report back a success.

from zeronet.

HelloZeroNet avatar HelloZeroNet commented on April 28, 2024

For unknown reason it stopped working for me. (nothing changed: same version that worked before, same router, same computer)

The ssdp discovery UDP packets not even visible using packet analyzer (smartsniff)

If i put sock.bind(("192.168.1.10",999)) to _m_search_ssdp it wokring fine also tried sock.bind(("",999)), but no luck. Any idea?

from zeronet.

HelloZeroNet avatar HelloZeroNet commented on April 28, 2024

Made it work by detecting local ips (+added some logging, fixed the successful run check and it also can be run by standalone using python UpnpPunch.py):
https://gist.github.com/HelloZeroNet/5133c7f03030620c278f

Please test :)

Update#1:

socket.gethostbyname_ex('') does not works on linux, but the getsockname() gives the correct answer, so it should work there.

>>> socket.gethostbyname_ex('')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
socket.herror: [Errno 4] No address associated with name
>>> s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
>>> s.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1)
>>> s.connect(('239.255.255.250', 1))
>>> s.getsockname()[0]
'176.231.40.130'

Result on my windows pc:

>>> socket.gethostbyname_ex('')
('short-pc', [], ['192.168.1.10'])
>>> s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
>>> s.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1)
>>> s.connect(('239.255.255.250', 1))
>>> s.getsockname()[0]
'127.0.0.1'

it worked before, so probably sometomes the s.getsockname()[0] returning the '192.168.1.10' ip as answer

if we can find a way to list available ip address on mac/linux then we can also add them to probe iplist

Update#2:
Added this one too, because it returns correct ip on both platform:

>>> s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
>>> s.connect(('8.8.8.8', 0)) # Using google dns route
>>> s.getsockname()[0]
'192.168.1.10'

from zeronet.

sirMackk avatar sirMackk commented on April 28, 2024

Whoa, thanks! I'll test it out soon as I'm home today. Got a windows box
and two routers to test it.
On Mar 7, 2015 4:35 PM, "ZeroNet" [email protected] wrote:

Made it work by detecting local ips (+added some logging, fixed the
successful run check and it also can be run by standalone using python
UpnpPunch.py):
https://gist.github.com/HelloZeroNet/5133c7f03030620c278f

Please test :)


Reply to this email directly or view it on GitHub
#54 (comment).

from zeronet.

sirMackk avatar sirMackk commented on April 28, 2024

I checked out the code and it works on both a linux machine and a windows machine on two different routers and it forwards the port without a hitch. Nice job on update 2 - that was the trickiest part. Should we leave it on my fork for more testing or should I submit a PR?

from zeronet.

HelloZeroNet avatar HelloZeroNet commented on April 28, 2024

I think its clearly fixes some problems, so the PR is welcomed

from zeronet.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.