Get current host's local IP

June 24, 2023 | Tags: python networking TIL

Sometimes, when working in a private network, it can be useful to know the current host IP address. If you are in the Linux shell, it can be as easy as using ifconfig and get it from there. However, if you need it in your application or in a script or in a programatic way, it's better to use the socket module from the standard library.

[Read more]

Send UDP packets in python

Aug. 18, 2022 | Tags: python networking udp TIL

Not that it's terribly hard to do, but is one of these useful things to know anb be able to source. Using the sockets library is triivally easy if you know the parameters you need to use (and it's very well documented).

[Read more]