Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(Windows) net_if_addrs() should return broadcast address #669

Closed
giampaolo opened this issue Aug 7, 2015 · 7 comments · Fixed by #2501
Closed

(Windows) net_if_addrs() should return broadcast address #669

giampaolo opened this issue Aug 7, 2015 · 7 comments · Fixed by #2501

Comments

@giampaolo
Copy link
Owner

giampaolo commented Aug 7, 2015

Netmask and broadcast addresses are currently not returned on Windows. https://pypi.python.org/pypi/netifaces/ lib support both but the code is kinda twisted and not so easy to port. CC @mrjefftang in case you want to give this a try.

Edit: netmask added as of #874

@giampaolo
Copy link
Owner Author

...also, now we have ptp (point to point) addresses as well (see #668) but I'm not sure whether Windows support them.

@richard-kinder
Copy link

Any update on this request? I'm happy to help get this implemented.

@giampaolo
Copy link
Owner Author

Feel free to make a pull request. Personally I don't think I will do it any
time soon.
Il 23/mar/2016 05:25, "richard-kinder" [email protected] ha
scritto:

Any update on this request? I'm happy to help get this implemented.


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
#669 (comment)

@giampaolo
Copy link
Owner Author

Here's a PR for netmask: #874

@giampaolo giampaolo changed the title (Windows) net_if_addrs() should support netmask and broadcast (Windows) net_if_addrs() should return broadcast address Nov 13, 2016
@Ragzouken
Copy link

Ragzouken commented Jan 23, 2025

I don't know psutil well enough to attempt a PR integrating it, but with the address and netmask you can compute the broadcast address like so:

import ipaddress
broadcast = ipaddress.IPv4Network(f"{address}/{netmask}", strict=False).broadcast_address

@giampaolo
Copy link
Owner Author

Thanks a lot for the hint. Implemented in #2501.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants